You're not passing an input_value parameter?
e.g.
A_User ()
: m_a_ptr ( new A(42) )
{}
Richard
On 3/23/07, Stephen Torri
I am attempting to hunt down why I am getting a segmentation fault from the boost::shared_ptr class. I know that it has to do with how I am managing my shared pointers. That is creating and using them in functions. I am reading the best practices web page and I have a question about the best way to initialize a shared_ptr.
Normally I have a class like the following:
class A { public:
typedef boost::shared_ptr<A> ptr_t;
A ( int input_value ) : value ( input_value ) {}
private: int value; };
Which I will use in another place:
class A_User { public:
A_User () : m_a_ptr ( new A() ) {}
private:
A::ptr_t m_a_ptr; };
Is this the correct way to initialize the A::ptr_t held in the A_User class in its constructor?
Stephen
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users