Is there any interest in a smart pointer facade class?

Is there any interest in a smart pointer facade class? I have in mind a class, that works similarily to boost::iterator_facade for developers of smart pointers instead of iterators. template < class Derived, class Pointee > class smart_ptr_facade; Recently I wrote two smart pointer classes, and felt the need for such a class. I would like to write such a class, and if everything goes well, perhaps add it to the Boost library. Regards Krzysztof Czainski

On Wed, Sep 22, 2010 at 8:03 AM, Krzysztof Czainski <1czajnik@gmail.com> wrote:
Is there any interest in a smart pointer facade class?
I have in mind a class, that works similarily to boost::iterator_facade for developers of smart pointers instead of iterators.
template < class Derived, class Pointee > class smart_ptr_facade;
Recently I wrote two smart pointer classes, and felt the need for such a class. I would like to write such a class, and if everything goes well, perhaps add it to the Boost library.
It is supposed to be something like a more powerful intrusive_ptr? Can you give a usage example? -- Cory Nelson http://int64.org

On Sep 22, 2010, at 12:35 PM, Cory Nelson wrote:
Recently I wrote two smart pointer classes, and felt the need for such a class. I would like to write such a class, and if everything goes well, perhaps add it to the Boost library.
It is supposed to be something like a more powerful intrusive_ptr? Can you give a usage example?
I think the general idea is that this would be closer to a policy-based smart pointer. -- Dave Abrahams BoostPro Computing http://boostpro.com

Zitat von David Abrahams <dave@boostpro.com>:
On Sep 22, 2010, at 12:35 PM, Cory Nelson wrote:
Recently I wrote two smart pointer classes, and felt the need for such a class. I would like to write such a class, and if everything goes well, perhaps add it to the Boost library.
It is supposed to be something like a more powerful intrusive_ptr? Can you give a usage example?
I think the general idea is that this would be closer to a policy-based smart pointer.
I think it`s neither, but a CRTP class implementing the "pointer concept": struct my_ptr : smart_ptr_facade<my_ptr,...>{ void set(T *rhs){ ptr=rhs; } T *get() const{ return ptr; } T *ptr; }; => my_ptr has ptr semantics, including operator->, operator=, ... iterator_facade simplifies implementing iterators a lot, so could this class for pointers, and other facades, e.g. a vector_facade that implements the std::vector interface in terms of 3 or 4 user-supplied functions.
participants (4)
-
Cory Nelson
-
David Abrahams
-
Krzysztof Czainski
-
Stefan Strasser