m_rectangle is private of rectangle_with_profile<Rect_class> and defined as
boost::shared_ptr<Rect_class> m_rectangle;
Thanks
Olivier Tournaire wrote:
> Hi all,
>
> I am trying to use shared_ptr in my code, but, I encoutered some problems.
> Here is a piece of my code :
>
> The main :
>
> boost::shared_ptr<OGRRectangle> rect( new OGRRectangle(5.,TPoint2D
> <double>(50.,20.),0.1325) );
> boost::shared_ptr< rectangle_with_profile<OGRRectangle> > r( new
> rectangle_with_profile<OGRRectangle> ( rect , 5 , 12 , 1.5 , EXTREME) );
>
> The rectangle_with_profile<T> constructor :
>
> template <class Rect_class>
> rectangle_with_profile<Rect_class>::rectangle_with_profile(
> boost::shared_ptr<Rect_class> rect , const unsigned int &nb_profiles ,
> const unsigned int &nb_points , const double &distance , const
> eProfilePosition &position=CENTER )
> {
> m_rectangle = rect;
> // ...
> // ...
> }
What is the Type of m_rectangle? It should be m_rectangle? If it isnt, this
is maybe the problem (And it is of type scoped_ptr e.g.)
Because than maybe the scoped_ptr would call the destructor. Could you post
some more quellcode?
Greetings
Manuel Jung
> Just after the line
> boost::shared_ptr< rectangle_with_profile<OGRRectangle> > r( new
> rectangle_with_profile<OGRRectangle> ( rect , 5 , 12 , 1.5 , EXTREME) );
> the rect<T> destructor is called, and the m_rectangle in
> rectangle_with_profile handles a deleted pointer ...
>
> What am I missing ?
>
> Thanks in advance for your help.
>
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users