Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-08-09 09:07:55


----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>

> I propose the following alternative to your patch:
>
> * New header boost/throw.hpp:
>
> #ifdef BOOST_NO_EXCEPTIONS
>
> #include <exception>
>
> void boost_throw(std::exception const & e); // user defined
>
> #else
>
> template<class E> void boost_throw(E const & e)
> {
> throw e;
> }
>
> #endif
>
> * shared_count changes:
>
> - if(use_count_ == 0 && weak_count_ != 0) throw
use_count_is_zero();
> + if(use_count_ == 0 && weak_count_ != 0)
> ::boost_throw(use_count_is_zero());
>
> and similarly for the other occurence:
>
> +#ifndef BOOST_NO_EXCEPTIONS
> try
> {
> pi_ = new counted_base_impl<P, D>(p, d, 1, 1);
> @@ -244,6 +248,10 @@
> d(p); // delete p
> throw;
> }
> +#else
> + pi_ = new counted_base_impl<P, D>(p, d, 1, 1);
> + if(pi_ == 0) ::boost_throw(std::bad_alloc());
> +#endif
>
> Comments?

Why are you sticking boost_throw in the global namespace?

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com


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