Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-04-16 11:29:04


Matthias Troyer <troyer_at_[hidden]> writes:
>
> I never not needed mutable yet in any code of mine using random number
> generators. Could you give an example that shows where it is needed?

It's never needed because you can always pass the generator through
an adaptor:

    template <class F, class T = F::result_type>
    struct nullary_const_function
    {
        nullary_const_function(F& f) : f(f) {}
        T operator() const { return f(); }
        F& f;
    };

(or something).

It's just a matter of convenience.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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