Boost logo

Boost :

From: DKl_at_[hidden]
Date: 2002-04-19 08:12:54


Peter Dimov wrote:
> Respectfully disagree. Second-guessing the programmer is evil. Explicit
> is often better.

I haven't claimed differently! In fact, I would be pretty happy with
doing something like this (in the corresponding header declaring the
smart pointer):

  template <typename T>
  shared_ptr<T> make_intrusive(T* ptr) {
    typedef typename shared_ptr<T>::intrusive_tag intrusive_dummy;
    return shared_ptr<T>(ptr);
  }

  // some member functions
  shared_ptr<this_type> f1() { return make_intrusive(this); }
  shared_ptr<base_type> f2() { return make_intrusive<base_tpe>(this); }

Still, I claim that making 'shared_ptr<T>' and 'intrusive_ptr<T>'
different types *and* suggesting their use in interfaces (I don't care
about internal operations: this is subject to the implementer of the
component) is a bad idea.

--
<mailto:dietmar_kuehl_at_[hidden]> <http://www.dietmar-kuehl.de/>
Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>

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