Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-24 14:55:20

From: "David Abrahams" <david.abrahams_at_[hidden]>
> That's what I thought it was. And, if I'm not mistaken, it has all of the
> advantages and disadvantages of a proxy object (e.g. freely copyable,
> access members). In effect, it /is/ a proxy... if I'm not mistaken ;-)

Yes, it is a proxy. It has an operator T & () const; ...

> Does it support all of the operators supported for v?
> ref(v) = 4;
> ref(v) += 3;

... so yes, it supports most of the operations, as long as the compiler is
not broken (IOW on MSVC it does not.) It doesn't support operator(),
however. Apparently the conversion operator is not considered when you do

It's also possible to use ref() to indicate pass-by-reference (as I've done
in the Bind library) without relying on the proxy semantics.

Peter Dimov
Multi Media Ltd.

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