Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-04-19 05:33:42

"Matthias Troyer" <troyer_at_[hidden]> wrote in message
> On Thursday, April 17, 2003, at 02:14 AM, Thorsten Ottosen wrote:
> > behind the scene some random number generator is used and it is called
> > from
> > const functions.
> > we don't want to propagate non-constness, since the class is just a
> > source
> > of random directions ( anyway, such a propagation reminds me of Java's
> > checked exceptions in the sence that it affects a whole lot of code
> > that is
> > not supposed to be affected ).
> OK. Here in principle the direction() functions do change the internal
> state. Howeverm in your application you do not care since you do not
> need reproducability of the results for your application. Then you can
> hide the fact that the internal state of the random number generator is
> changed - which is exactly what mutable is for.

My point is that I will get reproducability anyway unless I introduce some
other kind of randomness in the
usage pattern of my classes.

When I don't what reproducability, I seed the generator differently with
e.g. std::time().

Does anybody have some real code where this property is lost had the
operator been const?

Does anybody have some real code where non-constness is propagated through
several layers of the
program's call chain?



Boost list run by bdawes at, gregod at, cpdaniel at, john at