Warning, /include/c++/v1/experimental/type_traits is written in an unsupported language. File is not indexed.
0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009
0010 #ifndef _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
0011 #define _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
0012
0013 /**
0014 experimental/type_traits synopsis
0015
0016 // C++1y
0017 #include <type_traits>
0018
0019 namespace std {
0020 namespace experimental {
0021 inline namespace fundamentals_v1 {
0022
0023 // 3.3.2, Other type transformations
0024 template <class> class invocation_type; // not defined
0025 template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>;
0026 template <class> class raw_invocation_type; // not defined
0027 template <class F, class... ArgTypes> class raw_invocation_type<F(ArgTypes...)>;
0028
0029 template <class T>
0030 using invocation_type_t = typename invocation_type<T>::type;
0031 template <class T>
0032 using raw_invocation_type_t = typename raw_invocation_type<T>::type;
0033
0034 // 3.3.4, Detection idiom
0035 template <class...> using void_t = void;
0036
0037 struct nonesuch {
0038 nonesuch() = delete;
0039 ~nonesuch() = delete;
0040 nonesuch(nonesuch const&) = delete;
0041 void operator=(nonesuch const&) = delete;
0042 };
0043
0044 template <template<class...> class Op, class... Args>
0045 using is_detected = see below;
0046 template <template<class...> class Op, class... Args>
0047 constexpr bool is_detected_v = is_detected<Op, Args...>::value;
0048 template <template<class...> class Op, class... Args>
0049 using detected_t = see below;
0050 template <class Default, template<class...> class Op, class... Args>
0051 using detected_or = see below;
0052 template <class Default, template<class...> class Op, class... Args>
0053 using detected_or_t = typename detected_or<Default, Op, Args...>::type;
0054 template <class Expected, template<class...> class Op, class... Args>
0055 using is_detected_exact = is_same<Expected, detected_t<Op, Args...>>;
0056 template <class Expected, template<class...> class Op, class... Args>
0057 constexpr bool is_detected_exact_v
0058 = is_detected_exact<Expected, Op, Args...>::value;
0059 template <class To, template<class...> class Op, class... Args>
0060 using is_detected_convertible = is_convertible<detected_t<Op, Args...>, To>;
0061 template <class To, template<class...> class Op, class... Args>
0062 constexpr bool is_detected_convertible_v
0063 = is_detected_convertible<To, Op, Args...>::value;
0064
0065 } // namespace fundamentals_v1
0066 } // namespace experimental
0067 } // namespace std
0068
0069 */
0070
0071 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0072 # include <__cxx03/experimental/type_traits>
0073 #else
0074 # include <__config>
0075
0076 # if _LIBCPP_STD_VER >= 14
0077
0078 # include <initializer_list>
0079 # include <type_traits>
0080
0081 # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0082 # pragma GCC system_header
0083 # endif
0084
0085 _LIBCPP_BEGIN_NAMESPACE_LFTS
0086
0087 // 3.3.2, Other type transformations
0088 /*
0089 template <class>
0090 class _LIBCPP_TEMPLATE_VIS raw_invocation_type;
0091
0092 template <class _Fn, class ..._Args>
0093 class _LIBCPP_TEMPLATE_VIS raw_invocation_type<_Fn(_Args...)>;
0094
0095 template <class>
0096 class _LIBCPP_TEMPLATE_VIS invokation_type;
0097
0098 template <class _Fn, class ..._Args>
0099 class _LIBCPP_TEMPLATE_VIS invokation_type<_Fn(_Args...)>;
0100
0101 template <class _Tp>
0102 using invokation_type_t = typename invokation_type<_Tp>::type;
0103
0104 template <class _Tp>
0105 using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
0106 */
0107
0108 // 3.3.4, Detection idiom
0109 template <class...>
0110 using void_t = void;
0111
0112 struct nonesuch : private __nat { // make nonesuch "not an aggregate"
0113 ~nonesuch() = delete;
0114 nonesuch(nonesuch const&) = delete;
0115 void operator=(nonesuch const&) = delete;
0116 };
0117
0118 template <class _Default, class _AlwaysVoid, template <class...> class _Op, class... _Args>
0119 struct _DETECTOR {
0120 using value_t = false_type;
0121 using type = _Default;
0122 };
0123
0124 template <class _Default, template <class...> class _Op, class... _Args>
0125 struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> {
0126 using value_t = true_type;
0127 using type = _Op<_Args...>;
0128 };
0129
0130 template <template <class...> class _Op, class... _Args>
0131 using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
0132 template <template <class...> class _Op, class... _Args>
0133 using detected_t = typename _DETECTOR<nonesuch, void, _Op, _Args...>::type;
0134 template <template <class...> class _Op, class... _Args>
0135 constexpr bool is_detected_v = is_detected<_Op, _Args...>::value;
0136
0137 template <class _Default, template <class...> class _Op, class... _Args>
0138 using detected_or = _DETECTOR<_Default, void, _Op, _Args...>;
0139 template <class _Default, template <class...> class _Op, class... _Args>
0140 using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
0141
0142 template <class _Expected, template <class...> class _Op, class... _Args>
0143 using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
0144 template <class _Expected, template <class...> class _Op, class... _Args>
0145 constexpr bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value;
0146
0147 template <class _To, template <class...> class _Op, class... _Args>
0148 using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, _To>;
0149 template <class _To, template <class...> class _Op, class... _Args>
0150 constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value;
0151
0152 _LIBCPP_END_NAMESPACE_LFTS
0153
0154 # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0155 # include <cstddef>
0156 # endif
0157
0158 # endif /* _LIBCPP_STD_VER >= 14 */
0159 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0160
0161 #endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */