
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