Boost logo

Boost :

From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-03-26 09:26:37


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

On Wednesday 26 March 2008 08:00 am, Daniel Frey wrote:
> On Wed, 2008-03-26 at 07:38 -0400, Frank Mori Hess wrote:
> > On Wednesday 26 March 2008 02:55, Daniel Frey wrote:
> > > Hello again,
> > >
> > > does shared_from_this() also guarantee that it never throws?
> >
> > No, it can throw bad_weak_ptr.
>
> <http://boost.org/libs/smart_ptr/smart_ptr.htm> states that only
> std::bad_alloc is thrown - if anything is thrown at all. Am I misreading
> that?

That's talking about the smart pointer classes. shared_from_this is a method
of enable_shared_from_this, which isn't a smart pointer.

> And reading the documentation for weak_ptr, it's not clear to me when a
> bad_weak_ptr exception is thrown at all. All weak_ptr functions are
> documented to never throw.

It's thrown by the shared_ptr constructor that takes a weak_ptr argument.

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

iD8DBQFH6k8R5vihyNWuA4URAsOqAKDA20XnxM+S95VOGXcr7t0JhwDfNwCghUZA
2EODtZcRe3M8JrOXgFNHVkE=
=70v9
-----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