Robert:<br /> <br />>First, I hope that you are aware of the issues with using floating point types<br />>with this library. If not, please read the rationale section of the<br />>documentation and the discussion in the related thread on the developers' list.<br />Yup, been following. You did a good job of educating me on a previous post... I think I understand the issue now, but don't really have much of an option. As far as I can undestand from the discussions, this is a general problem with equality operations with floating points and has nothing to do with your library. If this is true, I would change the "rationale" section to say that the mess is not your fault and it isn't a library problem and that you need to be just as careful as you would normally.<br /><br />>The constraint could look like this (written out of my head, not tested):<br />If this is possible, I am very happy. It looks like it is.<br />The only other things that I would say need to be thought through in the design is unions of constraints instead of just intersections of them. For example, I was checking this out a while back, and it manages the sets of intervals/etc. well: http://www.herold-faulhaber.de/itl/<br />I would wonder if formalizing intervals in this library (or using another) is a good way to deal with different bounds... but that is beyond my level of competence.<br /><br />> Why not just use numeric_limits<risk_aversion::value_type>?<br />1) Because I was too stupid to think of that, and <br />2) Because I want to be able to write generic functions such as:<br />template<typename T><br />bool is_NaN(T& t)<br />{<br /> return (t == std::numeric_limits< T >::quiet_NaN());<br />}<br /><br />Again, my idea is that I want to be able to throw around elements of constrained types to generic functions and all of the standard types of things I would do with the superset type.<br /><br /> <br />>Actually, only the mutating operators (++, --, =, += etc.) are overloaded. For<br />>I don't think this is needed. If you write:<br />> constrained<int> x, y, z;<br />> z = x + y;<br />>Then simply the + operator for int is used.<br />Even better. As long as it works for all of the auto conversions between intrinsic types we are also in business. e.g. <br />constrained<int> x, y, z;<br />double c;<br />z = c * x + y;<br /><br /><br />Thanks Robert. Great library, time for me to submit a glowing review.