Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-04-16 19:36:28


----- Original Message -----
From: "Matthias Troyer" <troyer_at_[hidden]>
[snip]
>. If the order
> >>> of the
> >>> sequence is important, that is still achievable if operator() is
> >>> const, it
> >>> is just not enforced by the compiler.
> >>
> >> Here I disagree. I actually do care very much about what number I get.
> >> There are several application where it is of essential importance to
> >> get the identical sequence again. I thus want to have control over
> >> where the internal state of the generator is changed - and that's
> >> where
> >> const comes in.
> >
> > you still have control, but the compiler doesn't. The compiler cannot
> > warn
> > you if you
> > use the random number generator somewhere else. But the same situation
> > arises if I declare
> > my variable mutable. Thus the only effect I get from a non-const
> > operator is
> > that I need to prefix my member variable
> > with mutable. (This issue would disappear if I make a local variable
> > instead
> > of a member variable, though)
>
> The compiler can warn me.

not in the case of a const operator()() which I was referring to.

best regards

Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk