20 May 21:20
Re: constrained_value redundant check?
From: Robert Kawulak <kawulak <at> student.agh.edu.pl>
Subject: Re: constrained_value redundant check?
Newsgroups: gmane.comp.lib.boost.devel
Date: 2008-05-20 19:20:37 GMT
Subject: Re: constrained_value redundant check?
Newsgroups: gmane.comp.lib.boost.devel
Date: 2008-05-20 19:20:37 GMT
> 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
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
RSS Feed