|
Boost Users : |
From: Richard Dingwall (rdingwall_at_[hidden])
Date: 2007-03-22 19:33:24
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 <storri_at_[hidden]> wrote:
> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net