Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-03 14:57:33


Beman Dawes <bdawes_at_[hidden]> writes:

> At 09:46 PM 2/2/2003, Howard Hinnant wrote:
>
> To me, a major benefit of a policy based design is to
> be able to accommodate a wide range of features,
> including those which find only limited use.
>
> If a policy based smart pointer can't accommodate a
> wide range of features, I start to wonder if the design
> itself is inflexible and flawed. That's why I worry a
> lot about whether a given PBSP design can handle
> apparently marginal uses.

There's no reason we have to be restricted to a single idiom AFAICT.
The GenVoca-style design we're using for the new iterator_adaptors is
great for adding new interface in the most-derived class. A blend of
techniques is often more effective than trying to cram everything into
a single approach. If you want a smart_ptr with implicit conversion,
one way might be:

  template <class T>
  struct legacy_ptr
    : smart_ptr<blah, blah, blah...>
  {
    
    legacy_ptr(T* p) : smart_ptr<blah...>(p) {}
    T* operator()() const { return this->get(); }
  };

-Ddave

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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