Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2000-05-30 12:54:01


on 5/30/00 10:48 AM, jsiek_at_[hidden] at jsiek_at_[hidden] wrote:
> template <class X, class Y>
> struct tied
> {
> tied(X& x, Y& y) : m_x(x), m_y(y) {}
>
> template <class T1, class T2>
> void operator=(const std::pair<T1,T2>& p)
> { m_x = p.first; m_y = p.second; }
> mutable X& m_x;
> mutable Y& m_y;
> };

What does the "mutable" accomplish here? I think that you can modify objects
through m_x and m_y regardless of whether the tied object is const or not.
For reference members, it seems that mutable is a no-op.

    -- Darin


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