Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-07-08 00:04:08


----- Original Message -----
From: "Daryle Walker" <darylew_at_[hidden]>

> I have suggestions to add classes to "utility.hpp." They are like the
> noncopyable class, except they are for the other automatic operators
> (address and comma).
>
> 1. unaddressable
> + blocks (unary) &
> + has private declarations (within a class/struct) of
> T* operator&();
> T const * operator&() const;
>
> 2. default_inoperable
> + blocks = & ,
> + has private declarations (within a class/struct) of
> T& operator=( const T& );
> T* operator&();
> T const * operator&() const;
> T operator,( const T& ) const;
> template <typename U>
> U operator,( const U& ) const;
>
> I don't know whether or not both forms of operators , or & are needed. I
> guess their (default) constructor and destructor would be protected and
> inline and be defined to do nothing, like in noncopyable.

Interesting, but are they useful?
It's easy to write a class whose default construction or copy-assignment
semantics don't work right, but operator, and operator& pretty much always
do the right thing. Do you have a motivating example for these?

-Dave


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