Boost logo

Boost :

From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-04-09 17:06:04


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 09 April 2008 15:47 pm, Daniel Frey wrote:
> What do you (and others) think about branching enable_shared_from_this<T>
> into two classes:
>
> low_overhead_enable_shared_from_this<T>
>
> and
>
> feature_rich_enable_shared_from_this<T>

What I would like better is something like a simple base class that shared_ptr
recognizes, which only has a single virtual member function like

virtual void accept_owner(shared_ptr<T> &owner);

which shared_ptr would call when it takes ownership of an object derived from
the aforementioned base class. Then you could use it to implement your
stripped down version of enable_shared_from_this, or whatever else you might
think of. Of course, you would still be inflicted with a vtable, but that
doesn't add any per-object space overhead, which seems to be what you're most
concerned about.

- --
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFH/S+/5vihyNWuA4URAl7OAKCRK7OTsHU2H4a0GKuLeMKyyvcDxgCffB7+
OqJHVtck2ucIbrqotEU7yd0=
=+6v3
-----END PGP SIGNATURE-----


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