This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: RFC: Add _GLIBCXX_NOEXCEPT_C macro for conditional noexcept
- From: Daniel KrÃgler <daniel dot kruegler at gmail dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 26 Jun 2015 20:45:11 +0200
- Subject: Re: RFC: Add _GLIBCXX_NOEXCEPT_C macro for conditional noexcept
- Authentication-results: sourceware.org; auth=none
- References: <20150626103318 dot GP2856 at redhat dot com>
2015-06-26 12:33 GMT+02:00 Jonathan Wakely <jwakely@redhat.com>:
> I keep considering making this change:
>
> --- a/libstdc++-v3/include/bits/c++config
> +++ b/libstdc++-v3/include/bits/c++config
> @@ -117,10 +117,12 @@
> # define _GLIBCXX_NOEXCEPT noexcept
> # define _GLIBCXX_USE_NOEXCEPT noexcept
> # define _GLIBCXX_THROW(_EXC)
> +# define _GLIBCXX_NOEXCEPT_C(_CONSTANT) noexcept(_CONSTANT)
> # else
> # define _GLIBCXX_NOEXCEPT
> # define _GLIBCXX_USE_NOEXCEPT throw()
> # define _GLIBCXX_THROW(_EXC) throw(_EXC)
> +# define _GLIBCXX_NOEXCEPT_C(_CONSTANT)
> # endif
> #endif
>
>
> It would allow code like this:
>
> basic_string()
> #if __cplusplus >= 201103L
> noexcept(is_nothrow_default_constructible<_Alloc>::value)
> #endif
>
> to be replaced with this:
>
> basic_string()
> _GLIBCXX_NOEXCEPT_C(is_nothrow_default_constructible<_Alloc>::value)
>
> But I can't decide if that's really an improvement.
>
> Does anyone else have an opinion?
To me, your change suggestion looks like a real improvement.
- Daniel