constrained_value redundant check?

constrained & operator = (const value_type & v) { if(constraint()(v)) _value = v; else error_handler()(_value, v, _constraint()); BOOST_ASSERT(_check_value()); << Isn't this redundant? return *this; } Maybe this should be: constrained & operator = (const value_type & v) { if(constraint()(v)) _value = v; else { error_handler()(_value, v, _constraint()); BOOST_ASSERT(_check_value()); } return *this; }

From: Neal Becker constrained & operator = (const value_type & v) { if(constraint()(v)) _value = v; else error_handler()(_value, v, _constraint());
BOOST_ASSERT(_check_value()); << Isn't this redundant? return *this; }
Maybe this should be:
constrained & operator = (const value_type & v) { if(constraint()(v)) _value = v; else { error_handler()(_value, v, _constraint());
BOOST_ASSERT(_check_value()); } return *this; }
Maybe it is a bit redundant, but intentional -- after all, you don't know what operator = does for sure. :P Anyway, it shouldn't cause any harm this way, but can help to find some rare bugs which would break the invariant. Best regards, Robert
participants (2)
-
Neal Becker
-
Robert Kawulak