Boost logo

Boost :

Subject: Re: [boost] [c++1] BOOST_NOEXCEPT macros?
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-10-08 21:11:52


on Sat Oct 08 2011, Beman Dawes <bdawes-AT-acm.org> wrote:

> Since Boost already has BOOST_NO_NOEXCEPT and at least one compiler
> (GCC) supports C++11 noexcept, I'd like to start using it in Boost
> code.
>
> So how about a <boost/detail/noexcept.hpp> header with the usual
> boilerplate and this:
>
> #ifndef BOOST_NO_NOEXCEPT
> # define BOOST_NOEXCEPT
> # define BOOST_NOEXCEPT_IF(Predicate)
> #else
> # define BOOST_NOEXCEPT no_except
> # define BOOST_NOEXCEPT_IF(Predicate) no_except(Predicate)
> #endif

> As was pointed out in a previous thread, there isn't any reliable
> C++03 alternative for either of these two, so nothing is attempted,
> and that's OK in C++03 code.

Sounds great to me!

> We could also define BOOST_NOEXCEPT_OPERATOR(Predicate), and have it
> fall back to true in C++03 code. I'm not expert enough to know if that
> is reliable or even useful, so am not proposing it.

I think it had better default to false; that would be the conservative
answer.

And the parameter is "Expression," I think.

I suggest BOOST_IS_NOEXCEPT(Expression)

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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