Boost logo

Boost :

Subject: Re: [boost] [c++1] BOOST_NOEXCEPT macros?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-10-08 21:20:11

Le 08/10/11 22:46, Jeffrey Lee Hellrung, Jr. a écrit :
> On Sat, Oct 8, 2011 at 1:34 PM, Beman Dawes<bdawes_at_[hidden]> 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:
>> # 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?
> No substantive comments at the moment, I just want to check spelling:
> "noexcept" or "no_except"? I had thought it was the former; your macro
> definitions suggest the latter.
Good idea. I would prefer if these macros are added to Boost.Config,
documented and in file boost/config/suffix.hpp.

Yes, the macros should be
# define BOOST_NOEXCEPT noexcept
# define BOOST_NOEXCEPT_IF(Predicate) noexcept(Predicate)

Could you provide a patch?


Boost list run by bdawes at, gregod at, cpdaniel at, john at