Patchwork [v3] Implement N3421 - make functors greater<>

login
register
mail settings
Submitter Jonathan Wakely
Date Nov. 1, 2013, 11:59 a.m.
Message ID <CAH6eHdQz5ZwZnPZtehD3EHnkkcypjsRhQBBBS7sK4ZzOF_pNkQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/287798/
State New
Headers show

Comments

Jonathan Wakely - Nov. 1, 2013, 11:59 a.m.
On 1 November 2013 11:48, Jonathan Wakely wrote:
> On 1 November 2013 11:28, Marc Glisse wrote:
>> On Fri, 1 Nov 2013, Jonathan Wakely wrote:
>>
>>> 2013-11-01  Jonathan Wakely  <jwakely.gcc@gmail.com>
>>>
>>>        N3421 C++1y Transparent functors
>>>        * include/bits/stl_function.h (plus<void>, minus<void>,
>>>        multiplies<void>, divides<void>, modulus<void>, negate<void>,
>>>        equal_to<void>, not_equal_to<void>, greater<void>, less<void>,
>>>        greater_equal<void>, less_equal<void>, logical_and<void>,
>>>        logical_or<void>, logical_not<void>, bit_and<void>, bit_or<void>,
>>>        bit_xor<void>, bit_not<void>): Define.
>>
>>
>> Thanks. Why use noexcept for everything except logical_not?
>
> Oops, because the regex I used to add noexcept only matched a
> trailing-return-type on a line by itself, and I missed that one. I'll
> fix it now, thanks!

Like so:

2013-11-01  Jonathan Wakely  <jwakely.gcc@gmail.com>

        * include/bits/stl_function.h (logical_not<void>): Add noexcept.

Tested x86_64-linux, committed to trunk. Thanks to Marc for checking it.
commit a4d1b5296bb21fc8b522702c17c34098bfea36b7
Author: Jonathan Wakely <jwakely.gcc@gmail.com>
Date:   Fri Nov 1 11:50:22 2013 +0000

    	* include/bits/stl_function.h (logical_not<void>): Add noexcept.

Patch

diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h
index d2e5d13..e5eed06 100644
--- a/libstdc++-v3/include/bits/stl_function.h
+++ b/libstdc++-v3/include/bits/stl_function.h
@@ -554,7 +554,9 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       template <typename _Tp>
 	auto
-	operator()(_Tp&& __t) const -> decltype(!std::forward<_Tp>(__t))
+	operator()(_Tp&& __t) const
+	noexcept(noexcept(!std::forward<_Tp>(__t)))
+	-> decltype(!std::forward<_Tp>(__t))
 	{ return !std::forward<_Tp>(__t); }
 
       typedef __is_transparent is_transparent;