diff options
author | ville <ville@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-12 13:56:31 +0000 |
---|---|---|
committer | ville <ville@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-12 13:56:31 +0000 |
commit | 888a21cddaa07ba79504005f54c90f341b115825 (patch) | |
tree | 4aa9af9ef4e0ebc7da2941e71cfe8f07cb9ce2fd /libstdc++-v3/include | |
parent | 296008a9d4e2305dbf691ffcae802abcb0fe29a9 (diff) | |
download | gcc-888a21cddaa07ba79504005f54c90f341b115825.tar.gz |
Implement D0013R2, logical type traits.
2015-11-12 Ville Voutilainen <ville.voutilainen@gmail.com>
Implement D0013R2, logical type traits.
/libstdc++-v3
* include/experimental/type_traits (conjunction_v, disjunction_v,
negation_v): New.
* include/std/type_traits (conjunction, disjunction, negation):
Likewise.
* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
Likewise.
* testsuite/experimental/type_traits/value.cc: Likewise.
* testsuite/20_util/logical_traits/requirements/explicit_instantiation.cc: New.
* testsuite/20_util/logical_traits/requirements/typedefs.cc: Likewise.
* testsuite/20_util/logical_traits/value.cc: Likewise.
/testsuite
* g++.dg/cpp0x/Wattributes1.C: Adjust.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230258 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/experimental/type_traits | 29 | ||||
-rw-r--r-- | libstdc++-v3/include/std/type_traits | 20 |
2 files changed, 49 insertions, 0 deletions
diff --git a/libstdc++-v3/include/experimental/type_traits b/libstdc++-v3/include/experimental/type_traits index b0ed3b0fa66..e4f3ffef004 100644 --- a/libstdc++-v3/include/experimental/type_traits +++ b/libstdc++-v3/include/experimental/type_traits @@ -271,6 +271,35 @@ template<typename _To, template<typename...> class _Op, typename... _Args> constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value; +#define __cpp_lib_experimental_logical_traits 201511 + +template<typename... _Bn> + struct conjunction + : __and_<_Bn...> + { }; + +template<typename... _Bn> + struct disjunction + : __or_<_Bn...> + { }; + +template<typename _Pp> + struct negation + : __not_<_Pp> + { }; + +template<typename... _Bn> + constexpr bool conjunction_v + = conjunction<_Bn...>::value; + +template<typename... _Bn> + constexpr bool disjunction_v + = disjunction<_Bn...>::value; + +template<typename _Pp> + constexpr bool negation_v + = negation<_Pp>::value; + _GLIBCXX_END_NAMESPACE_VERSION } // namespace fundamentals_v2 } // namespace experimental diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 7448d5b836f..e5102def906 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -154,6 +154,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant<bool, !_Pp::value> { }; +#if __cplusplus > 201402L + +#define __cpp_lib_logical_traits 201511 + + template<typename... _Bn> + struct conjunction + : __and_<_Bn...> + { }; + + template<typename... _Bn> + struct disjunction + : __or_<_Bn...> + { }; + + template<typename _Pp> + struct negation + : __not_<_Pp> + { }; +#endif + // For several sfinae-friendly trait implementations we transport both the // result information (as the member type) and the failure information (no // member type). This is very similar to std::enable_if, but we cannot use |