Boost logo

Boost :

Subject: [boost] [c++1] BOOST_NOEXCEPT macros?
From: Beman Dawes (bdawes_at_[hidden])
Date: 2011-10-08 16:34:13


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.

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.

Comments?

--Beman


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