From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-04-15 10:39:38
"Jonathan Adamczewski" <jadamcze_at_[hidden]> wrote in message
> > To me the important thing here is that
> > the modification of the internal state will not change the result of
> > subsequent call* to any function on the object. The next call will
> > always be the same random number. Yes, there is a state-change, but it
> > cannot be observed.Only procedures can make such changes. Thus the
> > is logically const.
> Even in your pregenerated array example - the index
> into the array will change between calls.
yep, you're all right.
but...I still need to ask
1) std::rand() do hides it state change. Why should these be different?
2) After all, a client don't care what random number he gets, only that he
gets one. The right result of a call to rand() is not that it is a
particular random number, but that it's a random number. If the order of the
sequence is important, that is still achievable if operator() is const, it
is just not enforced by the compiler.
3) so (as seen from the client in 99% of the time) what is really the
benefit of having a non-const operator() .?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk