Boost logo

Boost Users :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2007-07-13 05:02:57


hongleij_at_[hidden] wrote:

[...]

> /// why boost::shared_ptr can used to Minimize compilation dependencies between files,
> yet boost::scoped_ptr cannot. I needn't to use reference cout.may someboby help me out of the trouble.thanks!

scoped_ptr can be used like you want. From the smart_ptr
documentation: 'Note that scoped_ptr requires that T be a complete
type at destruction time, but shared_ptr does not.'

IOW, you need to define a possible empty destructor of your class in a
source file, and only there the complete type of T must be available.

See the example referenced in
http://boost.org/libs/smart_ptr/scoped_ptr.htm, section 'Handle/Body
Idiom'.

HTH, Markus


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