$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost] [shared_ptr] Some design advice
From: Johnny Willemsen (jwillemsen_at_[hidden])
Date: 2011-05-31 13:23:21
Hi,
I want to create some refcounted objects using shared_ptr. For example
if I have class A_impl, I want my users only to use A. So, I created the
following code:
class A_impl
{
public:
virtual ~A_impl () {};
void dosomething () {};
};
typedef shared_ptr <A_impl> A;
The challenge is now that I want to provide some typedefs on A (which is
a shared_ptr()). So that my users can use:
A::my_value_type;
I am aware of the reference_type, but I need to have some additonal
typedefs and constants as part of A.
I have started with a partial template specialization of shared_ptr, but
I have my doubts whether this is the correct way. Another option would
be to create our own shared_ptr that just embeds the boost_shared_ptr
and exposes just some of its methods.
Any specific ideas on this?
Regards,
Johnny