Boost logo

Boost :

From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-01-21 19:15:49


Daryle Walker wrote:
> Was it something like:
>
> template < typename T >
> class const_matching_ptr
> : private boost::noncopyable
> {
> public:
> explicit const_matching_ptr( T &x ) : x_( &x ) {}
>
> T * get() { return this->x_; }
> T const * get() const { return this->x_; }
> T volatile * get() volatile { return this->x_; }
> T const volatile * get() const volatile { return this->x_; }
>
> // Don't forget to do all the qualification combinations!
> // (Should we add const/volatile qualifications as a new
> // kind of template parameter? Look at how similar the
> // "get" methods were. This will get worse if we use
> // C-1999's "restrict".)
> T * operator ->();
> T & operator *();
> T & operator []( std::size_t i );
>
> private:
> T * x_;
> };

No, not really.

-- 
Daniel Wallin

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