Boost logo

Boost Users :

From: Olivier Tournaire (olitour_at_[hidden])
Date: 2007-05-08 13:22:22


m_rectangle is private of rectangle_with_profile<Rect_class> and defined as
boost::shared_ptr<Rect_class> m_rectangle;

Thanks

2007/5/8, Manuel Jung <gzahl_at_[hidden]>:
>
> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Le temps des cerises reviendra. Dans l'immédiat, c'est le temps des noyaux.
Courage.


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