Boost logo

Boost Users :

From: Zara (yozara_at_[hidden])
Date: 2007-07-13 03:31:30


On Fri, 13 Jul 2007 13:52:18 +0800 (CST), hongleij_at_[hidden] wrote:

<...>

>
>class CPeer;
>
>#include <boost/shared_ptr.hpp>
>#include <boost/scoped_ptr.hpp>
>
>
>class CPeerManager
>{
>public:
> CPeerManager();
> boost::scoped_ptr<CPeer> cp_; //error
> // boost::shared_ptr<CPeer> cp_; // ok
>};

<...>

The scoped_ptr is defined to be simple and to load as little as
possible the code using it. To uses all potimizations possible, it's
been designed in such a way that the struct pointed byt it must be
completely defined when the pointer is declared, so you should replace
the forward declaration "class C>Peer;" with the full declaration
(typically, ibcluding its corresponding header

regrads,

Zara


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