
Maciej Sobczak wrote:
In my opinion both approaches have their uses, just like std::vector and boost::array.
Right. We could support both ways by making the type of range the value is checked against configurable. I think of a static_range<> for compile-time checked values and dynamic_ranges to be setup at runtime. // compile time checked value typedef static_range<-10,+10> my_static_constraint; typedef constraint_value< my_static_constraint, some_more_policies > ct_value; ct_value ctv = 303; // asserts or throws or ... // runtime checked value typedef dynamic_range<int> my_dynamic_constraint; typedef constraint_value< my_dynamic_constraint, some_more_policies > rt_value; rt_value rtv; rtv.lower_bound( 0 ); rtv.upper_bound( 40 ); rtv = 20; // good rtv = -1; // bad Do you think thats possible?