On 6/11/2014 07:06 AM, Olaf Peter wrote:
Am 10.06.2014 18:28, schrieb Brandon Kohn:
I should note that in each of these specializations care must be taken that bounds are properly checked given the context of the conversion direction. In my test I essentially converted the fundamental type to an instance of intrinsic_type (via the template constructor) and then used that to compare with the bounds of the intrinsic_type<T>. In a real world example this is possibly nonsense.
I thought this is what the checker does already, including test on NaN and Inf. Could you explain this?
What I mean is that the range checker is checking the whether the values in the source instance can be represented in the target instance. So one must ensure that for a given conversion (like my_type -> int) a range_checker type exists which can perform that check. Your original checker did cover the types of checks needed, it just neglected to deal with the interfaces on the respective types (source/target.) Apologies if I'm stating the obvious. Let me know if you have any more issues. I'm happy to help. Cheers, Brandon