|
Boost : |
Subject: Re: [boost] [review][constrained_value] Review of Constrained Value Library begins today
From: Robert Kawulak (robert.kawulak_at_[hidden])
Date: 2008-12-08 10:34:16
> From: Thorsten Ottosen
> >> this seems *very inefficient* compared to only changing
> the constraint.
> >
> > You can't simply change the constraint if the current value does not
> > conform to it.You have to check that and eventually copy
> the value and
> > the constraint, call the error policy for them and assign them back.
> > In most common cases this seems not much more efficient than copying
> > the whole object and swapping it (considering the typical case when
> > one or both of the policies are empty or have trivial copy).
> >
> > Having said that, I agree with you at this point -- implementing
> > change_constraint as a member might allow for more efficient
> > implementation for some cases. This is an argument that
> might convince
> > me to make it a member and I will investigate this possibility.
>
> It seems to me that it must be possible to check the new constraint
> without creating a new object.
Yes, it is possible to check the constraint without this. The point is what
happens if the constraint is not valid. Error policy may need to modify the
constraint, so it has to be copied (the argument of change_constraint cannot be
modified).
Best regards,
Robert
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk