Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-10-19 10:10:32


From: "Daniel Frey" <d.frey_at_[hidden]>
> Hi,
>
> I have a (maybe dumb) question. The current version of shared_ptr contains
code
> like:
>
> typename detail::shared_ptr_traits<T>::reference operator* () const //
never throws
> {
> BOOST_ASSERT(px != 0);
> return *px;
> }
>
> What does "never throws" means

It means that operator* doesn't throw when its requirements ("The stored
pointer must not be 0") are met, otherwise the behavior is undefined.

> ... wrt BOOST_ASSERT?

BOOST_ASSERT(px != 0) must not throw when px != 0.

> Isn't this a contradiction?

No. :-)


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