
From: "Robert Kawulak" <kawulak@student.agh.edu.pl>
initialize() - returns a value used to default-initialize a constrained object;
It seems that you'd want it to take a non-const reference to avoid copying.
I'm afraid i don't understand what you mean...
Use void initialize(value_type & value_o); rather than value_type initialize(); Thus, when passed the data member to initialize, it can initialize that object directly. Granted, (N)RVO can often avoid the copy, but this change will ensure you get the efficiency.
BTW in the current version I've changed the name of basic_bounded template to constrained_type (I don't like constrained_value name which may be misleading, because it's a type of values rather than a value itself), and
I'm confused. I thought the whole point of your library was to create an object that *has* a value and to constrain that value to be a member of a prescribed set. That's how you can add them together, increment them, etc. Thus, "constrained_value" is exactly the right name.
Putting it simply, point of my library is to provide templates of classes of objects having a value conforming to given constraints. constrained_type (or whatever we'll call it) is a type (class template to be strict), how can a type be named "something_value"? Now that's confusing to me... Maybe constrained_values_type would be the most appropriate ;-)
What you are suggesting is equivalent to suggesting that std::vector should be named "vector_type" because it is a class template. The purpose of the class template is to create objects through instantiating specializations. It is those objects that are actually used. Thus, the type name should be indicative of the purpose and use of those objects. Those objects are values. The class name should indicate the value nature of those objects. -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;