2018-06-14 Jonathan Wakely <jwakely@redhat.com>
+ * include/std/tuple (__cpp_lib_tuple_element_t): Move feature test
+ macro from <utility> and change type to long.
+ * include/std/utility (__cpp_lib_tuple_element_t): Remove.
+ * testsuite/20_util/tuple/tuple_element_t.cc: Check for feature test
+ macro.
+
P0935R0 Eradicating unnecessarily explicit default constructors
* include/bits/random.h (uniform_real_distribution::param_type)
(normal_distribution::param_type, lognormal_distribution::param_type)
"tuple index is in range");
};
+#if __cplusplus >= 201402L
+#define __cpp_lib_tuple_element_t 201402L
+
+ template<size_t __i, typename _Tp>
+ using tuple_element_t = typename tuple_element<__i, _Tp>::type;
+#endif
+
template<std::size_t __i, typename _Head, typename... _Tail>
constexpr _Head&
__get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
return std::forward<const __element_type&&>(std::get<__i>(__t));
}
-#if __cplusplus > 201103L
+#if __cplusplus >= 201402L
#define __cpp_lib_tuples_by_type 201304
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2275. Why is forward_as_tuple not constexpr?
+ /// std::forward_as_tuple
template<typename... _Elements>
constexpr tuple<_Elements&&...>
forward_as_tuple(_Elements&&... __args) noexcept
typedef typename add_cv<__tuple_element_t<__i, _Tp>>::type type;
};
-#if __cplusplus > 201103L
-#define __cpp_lib_tuple_element_t 201402
-
- template<std::size_t __i, typename _Tp>
- using tuple_element_t = typename tuple_element<__i, _Tp>::type;
-#endif
-
// Various functions which give std::pair a tuple-like interface.
/// Partial specialization for std::pair
#include <tuple>
+#ifndef __cpp_lib_tuple_element_t
+# error "Feature-test macro for tuple_element_t missing"
+#elif __cpp_lib_tuple_element_t != 201402
+# error "Feature-test macro for tuple_element_t has wrong value"
+#endif
+
using namespace std;
struct foo