Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2002-07-28 22:00:41


"Gennadiy Rozental" <rogeeff_at_[hidden]> wrote in message
news:ai251r$sc$1_at_main.gmane.org...

[...]

> typedef counted<YourFancyClass> YourFancyClassEx;
> shared_ptr<YourFancyClassEx> = new YourFancyClassEx;
> ...
>
> For inrisic types you probably would want to specialize plain_pointer
> storage policy so you will not need to type .value every time.
>
> Gennadiy.
>
> P.S. It's only a sketch. But I hope you got the idea.

Well:
- counted<YourFancyClass> will have to rewrite every constructors of
YourFancyClass. Will begin to be problematic for QListViewItem for example:
many long constructors.
- You won't be able to assign shared_ptr<YourFancyClassParentEx> =
shared_ptr<YourFancyClassChildEx>. The counter won't be at the same offset.
- Will be painfull if you want to apply your technique to every widget of
the QT library i.e. an existing library with hundreds of heavy class with
complex constructors often.

Philippe A. Bouchard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk