diff mbox

[v3] Implement C++17 make_from_tuple.

Message ID CAFk2RUZUuPOXLOmMD9zoTo1P6ZuhTWuFd41w3eUJvCYhvwi+yQ@mail.gmail.com
State New
Headers show

Commit Message

Ville Voutilainen Aug. 14, 2016, 6:27 p.m. UTC
On 11 August 2016 at 21:05, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
>> The latest SD-6 has a feature test macro;
>>
>> #define __cpp_lib_make_from_tuple  201606
>>
>>
>> Also the test should get:
>>
>> #ifndef __cpp_lib_make_from_tuple
>> # error "Feature-test macro for make_from_tuple missing"
>> #elif __cpp_lib_make_from_tuple != 201606
>> # error "Feature-test macro for make_from_tuple has wrong value"
>> #endif
>
>
> Thanks, I tried to find a recent SD-6 when looking for a feature macro
> for make_from_tuple, but couldn't find one.
> I was not looking in the right place. :)

Here. Tested on Linux-x64. I made the test for the macro value compare
it relatively rather than exactly;
I don't think our tests should necessarily break just because a macro
value is updated.

2016-08-14  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Add a feature macro for C++17 make_from_tuple.
    * include/std/tuple (__cpp_lib_make_from_tuple): New.
    * testsuite/20_util/tuple/make_from_tuple/1.cc: Adjust.

Comments

Jonathan Wakely Aug. 15, 2016, 9:57 a.m. UTC | #1
On 14/08/16 21:27 +0300, Ville Voutilainen wrote:
>Here. Tested on Linux-x64. I made the test for the macro value compare
>it relatively rather than exactly;
>I don't think our tests should necessarily break just because a macro
>value is updated.
>
>2016-08-14  Ville Voutilainen  <ville.voutilainen@gmail.com>
>
>    Add a feature macro for C++17 make_from_tuple.
>    * include/std/tuple (__cpp_lib_make_from_tuple): New.
>    * testsuite/20_util/tuple/make_from_tuple/1.cc: Adjust.

OK, thanks.
diff mbox

Patch

diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 3403048..5ad171f 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -1656,6 +1656,8 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 			  _Indices{});
     }
 
+#define __cpp_lib_make_from_tuple  201606
+
   template <typename _Tp, typename _Tuple, size_t... _Idx>
     constexpr _Tp
     __make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>)
diff --git a/libstdc++-v3/testsuite/20_util/tuple/make_from_tuple/1.cc b/libstdc++-v3/testsuite/20_util/tuple/make_from_tuple/1.cc
index 459dc74..17aca31 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/make_from_tuple/1.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/make_from_tuple/1.cc
@@ -20,6 +20,12 @@ 
 #include <tuple>
 #include <testsuite_hooks.h>
 
+#ifndef __cpp_lib_make_from_tuple
+# error "Feature-test macro for make_from_tuple missing."
+#elif __cpp_lib_make_from_tuple < 201606
+# error "Feature-test macro for make_from_tuple has the wrong value."
+#endif
+
 template <class T, class U, class V>
 struct ThreeParam
 {