type_traits revision 288943
1// -*- C++ -*- 2//===-------------------------- type_traits -------------------------------===// 3// 4// The LLVM Compiler Infrastructure 5// 6// This file is dual licensed under the MIT and the University of Illinois Open 7// Source Licenses. See LICENSE.TXT for details. 8// 9//===----------------------------------------------------------------------===// 10 11#ifndef _LIBCPP_EXPERIMENTAL_TYPE_TRAITS 12#define _LIBCPP_EXPERIMENTAL_TYPE_TRAITS 13 14/** 15 experimental/type_traits synopsis 16 17// C++1y 18#include <type_traits> 19 20namespace std { 21namespace experimental { 22inline namespace fundamentals_v1 { 23 24 // See C++14 20.10.4.1, primary type categories 25 template <class T> constexpr bool is_void_v 26 = is_void<T>::value; 27 template <class T> constexpr bool is_null_pointer_v 28 = is_null_pointer<T>::value; 29 template <class T> constexpr bool is_integral_v 30 = is_integral<T>::value; 31 template <class T> constexpr bool is_floating_point_v 32 = is_floating_point<T>::value; 33 template <class T> constexpr bool is_array_v 34 = is_array<T>::value; 35 template <class T> constexpr bool is_pointer_v 36 = is_pointer<T>::value; 37 template <class T> constexpr bool is_lvalue_reference_v 38 = is_lvalue_reference<T>::value; 39 template <class T> constexpr bool is_rvalue_reference_v 40 = is_rvalue_reference<T>::value; 41 template <class T> constexpr bool is_member_object_pointer_v 42 = is_member_object_pointer<T>::value; 43 template <class T> constexpr bool is_member_function_pointer_v 44 = is_member_function_pointer<T>::value; 45 template <class T> constexpr bool is_enum_v 46 = is_enum<T>::value; 47 template <class T> constexpr bool is_union_v 48 = is_union<T>::value; 49 template <class T> constexpr bool is_class_v 50 = is_class<T>::value; 51 template <class T> constexpr bool is_function_v 52 = is_function<T>::value; 53 54 // See C++14 20.10.4.2, composite type categories 55 template <class T> constexpr bool is_reference_v 56 = is_reference<T>::value; 57 template <class T> constexpr bool is_arithmetic_v 58 = is_arithmetic<T>::value; 59 template <class T> constexpr bool is_fundamental_v 60 = is_fundamental<T>::value; 61 template <class T> constexpr bool is_object_v 62 = is_object<T>::value; 63 template <class T> constexpr bool is_scalar_v 64 = is_scalar<T>::value; 65 template <class T> constexpr bool is_compound_v 66 = is_compound<T>::value; 67 template <class T> constexpr bool is_member_pointer_v 68 = is_member_pointer<T>::value; 69 70 // See C++14 20.10.4.3, type properties 71 template <class T> constexpr bool is_const_v 72 = is_const<T>::value; 73 template <class T> constexpr bool is_volatile_v 74 = is_volatile<T>::value; 75 template <class T> constexpr bool is_trivial_v 76 = is_trivial<T>::value; 77 template <class T> constexpr bool is_trivially_copyable_v 78 = is_trivially_copyable<T>::value; 79 template <class T> constexpr bool is_standard_layout_v 80 = is_standard_layout<T>::value; 81 template <class T> constexpr bool is_pod_v 82 = is_pod<T>::value; 83 template <class T> constexpr bool is_literal_type_v 84 = is_literal_type<T>::value; 85 template <class T> constexpr bool is_empty_v 86 = is_empty<T>::value; 87 template <class T> constexpr bool is_polymorphic_v 88 = is_polymorphic<T>::value; 89 template <class T> constexpr bool is_abstract_v 90 = is_abstract<T>::value; 91 template <class T> constexpr bool is_final_v 92 = is_final<T>::value; 93 template <class T> constexpr bool is_signed_v 94 = is_signed<T>::value; 95 template <class T> constexpr bool is_unsigned_v 96 = is_unsigned<T>::value; 97 template <class T, class... Args> constexpr bool is_constructible_v 98 = is_constructible<T, Args...>::value; 99 template <class T> constexpr bool is_default_constructible_v 100 = is_default_constructible<T>::value; 101 template <class T> constexpr bool is_copy_constructible_v 102 = is_copy_constructible<T>::value; 103 template <class T> constexpr bool is_move_constructible_v 104 = is_move_constructible<T>::value; 105 template <class T, class U> constexpr bool is_assignable_v 106 = is_assignable<T, U>::value; 107 template <class T> constexpr bool is_copy_assignable_v 108 = is_copy_assignable<T>::value; 109 template <class T> constexpr bool is_move_assignable_v 110 = is_move_assignable<T>::value; 111 template <class T> constexpr bool is_destructible_v 112 = is_destructible<T>::value; 113 template <class T, class... Args> constexpr bool is_trivially_constructible_v 114 = is_trivially_constructible<T, Args...>::value; 115 template <class T> constexpr bool is_trivially_default_constructible_v 116 = is_trivially_default_constructible<T>::value; 117 template <class T> constexpr bool is_trivially_copy_constructible_v 118 = is_trivially_copy_constructible<T>::value; 119 template <class T> constexpr bool is_trivially_move_constructible_v 120 = is_trivially_move_constructible<T>::value; 121 template <class T, class U> constexpr bool is_trivially_assignable_v 122 = is_trivially_assignable<T, U>::value; 123 template <class T> constexpr bool is_trivially_copy_assignable_v 124 = is_trivially_copy_assignable<T>::value; 125 template <class T> constexpr bool is_trivially_move_assignable_v 126 = is_trivially_move_assignable<T>::value; 127 template <class T> constexpr bool is_trivially_destructible_v 128 = is_trivially_destructible<T>::value; 129 template <class T, class... Args> constexpr bool is_nothrow_constructible_v 130 = is_nothrow_constructible<T, Args...>::value; 131 template <class T> constexpr bool is_nothrow_default_constructible_v 132 = is_nothrow_default_constructible<T>::value; 133 template <class T> constexpr bool is_nothrow_copy_constructible_v 134 = is_nothrow_copy_constructible<T>::value; 135 template <class T> constexpr bool is_nothrow_move_constructible_v 136 = is_nothrow_move_constructible<T>::value; 137 template <class T, class U> constexpr bool is_nothrow_assignable_v 138 = is_nothrow_assignable<T, U>::value; 139 template <class T> constexpr bool is_nothrow_copy_assignable_v 140 = is_nothrow_copy_assignable<T>::value; 141 template <class T> constexpr bool is_nothrow_move_assignable_v 142 = is_nothrow_move_assignable<T>::value; 143 template <class T> constexpr bool is_nothrow_destructible_v 144 = is_nothrow_destructible<T>::value; 145 template <class T> constexpr bool has_virtual_destructor_v 146 = has_virtual_destructor<T>::value; 147 148 // See C++14 20.10.5, type property queries 149 template <class T> constexpr size_t alignment_of_v 150 = alignment_of<T>::value; 151 template <class T> constexpr size_t rank_v 152 = rank<T>::value; 153 template <class T, unsigned I = 0> constexpr size_t extent_v 154 = extent<T, I>::value; 155 156 // See C++14 20.10.6, type relations 157 template <class T, class U> constexpr bool is_same_v 158 = is_same<T, U>::value; 159 template <class Base, class Derived> constexpr bool is_base_of_v 160 = is_base_of<Base, Derived>::value; 161 template <class From, class To> constexpr bool is_convertible_v 162 = is_convertible<From, To>::value; 163 164 // 3.3.2, Other type transformations 165 template <class> class invocation_type; // not defined 166 template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>; 167 template <class> class raw_invocation_type; // not defined 168 template <class F, class... ArgTypes> class raw_invocation_type<F(ArgTypes...)>; 169 170 template <class T> 171 using invocation_type_t = typename invocation_type<T>::type; 172 template <class T> 173 using raw_invocation_type_t = typename raw_invocation_type<T>::type; 174 175} // namespace fundamentals_v1 176} // namespace experimental 177} // namespace std 178 179 */ 180 181#include <experimental/__config> 182 183#if _LIBCPP_STD_VER > 11 184 185#include <type_traits> 186 187#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 188#pragma GCC system_header 189#endif 190 191_LIBCPP_BEGIN_NAMESPACE_LFTS 192 193#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 194 195// C++14 20.10.4.1, primary type categories 196 197template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v 198 = is_void<_Tp>::value; 199 200template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v 201 = is_null_pointer<_Tp>::value; 202 203template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v 204 = is_integral<_Tp>::value; 205 206template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v 207 = is_floating_point<_Tp>::value; 208 209template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v 210 = is_array<_Tp>::value; 211 212template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v 213 = is_pointer<_Tp>::value; 214 215template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v 216 = is_lvalue_reference<_Tp>::value; 217 218template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v 219 = is_rvalue_reference<_Tp>::value; 220 221template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v 222 = is_member_object_pointer<_Tp>::value; 223 224template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v 225 = is_member_function_pointer<_Tp>::value; 226 227template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v 228 = is_enum<_Tp>::value; 229 230template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v 231 = is_union<_Tp>::value; 232 233template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v 234 = is_class<_Tp>::value; 235 236template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v 237 = is_function<_Tp>::value; 238 239// C++14 20.10.4.2, composite type categories 240 241template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v 242 = is_reference<_Tp>::value; 243 244template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v 245 = is_arithmetic<_Tp>::value; 246 247template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v 248 = is_fundamental<_Tp>::value; 249 250template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v 251 = is_object<_Tp>::value; 252 253template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v 254 = is_scalar<_Tp>::value; 255 256template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v 257 = is_compound<_Tp>::value; 258 259template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v 260 = is_member_pointer<_Tp>::value; 261 262// C++14 20.10.4.3, type properties 263 264template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v 265 = is_const<_Tp>::value; 266 267template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v 268 = is_volatile<_Tp>::value; 269 270template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v 271 = is_trivial<_Tp>::value; 272 273template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v 274 = is_trivially_copyable<_Tp>::value; 275 276template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v 277 = is_standard_layout<_Tp>::value; 278 279template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v 280 = is_pod<_Tp>::value; 281 282template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v 283 = is_literal_type<_Tp>::value; 284 285template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v 286 = is_empty<_Tp>::value; 287 288template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v 289 = is_polymorphic<_Tp>::value; 290 291template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v 292 = is_abstract<_Tp>::value; 293 294template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v 295 = is_final<_Tp>::value; 296 297template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v 298 = is_signed<_Tp>::value; 299 300template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v 301 = is_unsigned<_Tp>::value; 302 303template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_constructible_v 304 = is_constructible<_Tp, _Ts...>::value; 305 306template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v 307 = is_default_constructible<_Tp>::value; 308 309template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v 310 = is_copy_constructible<_Tp>::value; 311 312template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v 313 = is_move_constructible<_Tp>::value; 314 315template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_assignable_v 316 = is_assignable<_Tp, _Up>::value; 317 318template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v 319 = is_copy_assignable<_Tp>::value; 320 321template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v 322 = is_move_assignable<_Tp>::value; 323 324template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v 325 = is_destructible<_Tp>::value; 326 327template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v 328 = is_trivially_constructible<_Tp, _Ts...>::value; 329 330template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v 331 = is_trivially_default_constructible<_Tp>::value; 332 333template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v 334 = is_trivially_copy_constructible<_Tp>::value; 335 336template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v 337 = is_trivially_move_constructible<_Tp>::value; 338 339template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v 340 = is_trivially_assignable<_Tp, _Up>::value; 341 342template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v 343 = is_trivially_copy_assignable<_Tp>::value; 344 345template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v 346 = is_trivially_move_assignable<_Tp>::value; 347 348template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v 349 = is_trivially_destructible<_Tp>::value; 350 351template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v 352 = is_nothrow_constructible<_Tp, _Ts...>::value; 353 354template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v 355 = is_nothrow_default_constructible<_Tp>::value; 356 357template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v 358 = is_nothrow_copy_constructible<_Tp>::value; 359 360template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v 361 = is_nothrow_move_constructible<_Tp>::value; 362 363template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v 364 = is_nothrow_assignable<_Tp, _Up>::value; 365 366template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v 367 = is_nothrow_copy_assignable<_Tp>::value; 368 369template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v 370 = is_nothrow_move_assignable<_Tp>::value; 371 372template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v 373 = is_nothrow_destructible<_Tp>::value; 374 375template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v 376 = has_virtual_destructor<_Tp>::value; 377 378// C++14 20.10.5, type properties queries 379 380template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v 381 = alignment_of<_Tp>::value; 382 383template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v 384 = rank<_Tp>::value; 385 386template <class _Tp, unsigned _Id = 0> _LIBCPP_CONSTEXPR size_t extent_v 387 = extent<_Tp, _Id>::value; 388 389// C++14 20.10.6, type relations 390 391template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v 392 = is_same<_Tp, _Up>::value; 393 394template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v 395 = is_base_of<_Tp, _Up>::value; 396 397template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v 398 = is_convertible<_Tp, _Up>::value; 399 400#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */ 401 402// 3.3.2, Other type transformations 403/* 404template <class> 405class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type; 406 407template <class _Fn, class ..._Args> 408class _LIBCPP_TYPE_VIS_ONLY raw_invocation_type<_Fn(_Args...)>; 409 410template <class> 411class _LIBCPP_TYPE_VIS_ONLY invokation_type; 412 413template <class _Fn, class ..._Args> 414class _LIBCPP_TYPE_VIS_ONLY invokation_type<_Fn(_Args...)>; 415 416template <class _Tp> 417using invokation_type_t = typename invokation_type<_Tp>::type; 418 419template <class _Tp> 420using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type; 421*/ 422 423_LIBCPP_END_NAMESPACE_LFTS 424 425#endif /* _LIBCPP_STD_VER > 11 */ 426 427#endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */ 428