/usr/include/c++/v1/experimental/type_traits is in libc++-dev 6.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | // -*- C++ -*-
//===-------------------------- type_traits -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
#define _LIBCPP_EXPERIMENTAL_TYPE_TRAITS
/**
experimental/type_traits synopsis
// C++1y
#include <type_traits>
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
// See C++14 20.10.4.1, primary type categories
template <class T> constexpr bool is_void_v
= is_void<T>::value;
template <class T> constexpr bool is_null_pointer_v
= is_null_pointer<T>::value;
template <class T> constexpr bool is_integral_v
= is_integral<T>::value;
template <class T> constexpr bool is_floating_point_v
= is_floating_point<T>::value;
template <class T> constexpr bool is_array_v
= is_array<T>::value;
template <class T> constexpr bool is_pointer_v
= is_pointer<T>::value;
template <class T> constexpr bool is_lvalue_reference_v
= is_lvalue_reference<T>::value;
template <class T> constexpr bool is_rvalue_reference_v
= is_rvalue_reference<T>::value;
template <class T> constexpr bool is_member_object_pointer_v
= is_member_object_pointer<T>::value;
template <class T> constexpr bool is_member_function_pointer_v
= is_member_function_pointer<T>::value;
template <class T> constexpr bool is_enum_v
= is_enum<T>::value;
template <class T> constexpr bool is_union_v
= is_union<T>::value;
template <class T> constexpr bool is_class_v
= is_class<T>::value;
template <class T> constexpr bool is_function_v
= is_function<T>::value;
// See C++14 20.10.4.2, composite type categories
template <class T> constexpr bool is_reference_v
= is_reference<T>::value;
template <class T> constexpr bool is_arithmetic_v
= is_arithmetic<T>::value;
template <class T> constexpr bool is_fundamental_v
= is_fundamental<T>::value;
template <class T> constexpr bool is_object_v
= is_object<T>::value;
template <class T> constexpr bool is_scalar_v
= is_scalar<T>::value;
template <class T> constexpr bool is_compound_v
= is_compound<T>::value;
template <class T> constexpr bool is_member_pointer_v
= is_member_pointer<T>::value;
// See C++14 20.10.4.3, type properties
template <class T> constexpr bool is_const_v
= is_const<T>::value;
template <class T> constexpr bool is_volatile_v
= is_volatile<T>::value;
template <class T> constexpr bool is_trivial_v
= is_trivial<T>::value;
template <class T> constexpr bool is_trivially_copyable_v
= is_trivially_copyable<T>::value;
template <class T> constexpr bool is_standard_layout_v
= is_standard_layout<T>::value;
template <class T> constexpr bool is_pod_v
= is_pod<T>::value;
template <class T> constexpr bool is_literal_type_v
= is_literal_type<T>::value;
template <class T> constexpr bool is_empty_v
= is_empty<T>::value;
template <class T> constexpr bool is_polymorphic_v
= is_polymorphic<T>::value;
template <class T> constexpr bool is_abstract_v
= is_abstract<T>::value;
template <class T> constexpr bool is_final_v
= is_final<T>::value;
template <class T> constexpr bool is_signed_v
= is_signed<T>::value;
template <class T> constexpr bool is_unsigned_v
= is_unsigned<T>::value;
template <class T, class... Args> constexpr bool is_constructible_v
= is_constructible<T, Args...>::value;
template <class T> constexpr bool is_default_constructible_v
= is_default_constructible<T>::value;
template <class T> constexpr bool is_copy_constructible_v
= is_copy_constructible<T>::value;
template <class T> constexpr bool is_move_constructible_v
= is_move_constructible<T>::value;
template <class T, class U> constexpr bool is_assignable_v
= is_assignable<T, U>::value;
template <class T> constexpr bool is_copy_assignable_v
= is_copy_assignable<T>::value;
template <class T> constexpr bool is_move_assignable_v
= is_move_assignable<T>::value;
template <class T> constexpr bool is_destructible_v
= is_destructible<T>::value;
template <class T, class... Args> constexpr bool is_trivially_constructible_v
= is_trivially_constructible<T, Args...>::value;
template <class T> constexpr bool is_trivially_default_constructible_v
= is_trivially_default_constructible<T>::value;
template <class T> constexpr bool is_trivially_copy_constructible_v
= is_trivially_copy_constructible<T>::value;
template <class T> constexpr bool is_trivially_move_constructible_v
= is_trivially_move_constructible<T>::value;
template <class T, class U> constexpr bool is_trivially_assignable_v
= is_trivially_assignable<T, U>::value;
template <class T> constexpr bool is_trivially_copy_assignable_v
= is_trivially_copy_assignable<T>::value;
template <class T> constexpr bool is_trivially_move_assignable_v
= is_trivially_move_assignable<T>::value;
template <class T> constexpr bool is_trivially_destructible_v
= is_trivially_destructible<T>::value;
template <class T, class... Args> constexpr bool is_nothrow_constructible_v
= is_nothrow_constructible<T, Args...>::value;
template <class T> constexpr bool is_nothrow_default_constructible_v
= is_nothrow_default_constructible<T>::value;
template <class T> constexpr bool is_nothrow_copy_constructible_v
= is_nothrow_copy_constructible<T>::value;
template <class T> constexpr bool is_nothrow_move_constructible_v
= is_nothrow_move_constructible<T>::value;
template <class T, class U> constexpr bool is_nothrow_assignable_v
= is_nothrow_assignable<T, U>::value;
template <class T> constexpr bool is_nothrow_copy_assignable_v
= is_nothrow_copy_assignable<T>::value;
template <class T> constexpr bool is_nothrow_move_assignable_v
= is_nothrow_move_assignable<T>::value;
template <class T> constexpr bool is_nothrow_destructible_v
= is_nothrow_destructible<T>::value;
template <class T> constexpr bool has_virtual_destructor_v
= has_virtual_destructor<T>::value;
// See C++14 20.10.5, type property queries
template <class T> constexpr size_t alignment_of_v
= alignment_of<T>::value;
template <class T> constexpr size_t rank_v
= rank<T>::value;
template <class T, unsigned I = 0> constexpr size_t extent_v
= extent<T, I>::value;
// See C++14 20.10.6, type relations
template <class T, class U> constexpr bool is_same_v
= is_same<T, U>::value;
template <class Base, class Derived> constexpr bool is_base_of_v
= is_base_of<Base, Derived>::value;
template <class From, class To> constexpr bool is_convertible_v
= is_convertible<From, To>::value;
// 3.3.2, Other type transformations
template <class> class invocation_type; // not defined
template <class F, class... ArgTypes> class invocation_type<F(ArgTypes...)>;
template <class> class raw_invocation_type; // not defined
template <class F, class... ArgTypes> class raw_invocation_type<F(ArgTypes...)>;
template <class T>
using invocation_type_t = typename invocation_type<T>::type;
template <class T>
using raw_invocation_type_t = typename raw_invocation_type<T>::type;
// 3.3.3, Logical operator traits
template<class... B> struct conjunction;
template<class... B> constexpr bool conjunction_v = conjunction<B...>::value;
template<class... B> struct disjunction;
template<class... B> constexpr bool disjunction_v = disjunction<B...>::value;
template<class B> struct negation;
template<class B> constexpr bool negation_v = negation<B>::value;
// 3.3.4, Detection idiom
template <class...> using void_t = void;
struct nonesuch {
nonesuch() = delete;
~nonesuch() = delete;
nonesuch(nonesuch const&) = delete;
void operator=(nonesuch const&) = delete;
};
template <template<class...> class Op, class... Args>
using is_detected = see below;
template <template<class...> class Op, class... Args>
constexpr bool is_detected_v = is_detected<Op, Args...>::value;
template <template<class...> class Op, class... Args>
using detected_t = see below;
template <class Default, template<class...> class Op, class... Args>
using detected_or = see below;
template <class Default, template<class...> class Op, class... Args>
using detected_or_t = typename detected_or<Default, Op, Args...>::type;
template <class Expected, template<class...> class Op, class... Args>
using is_detected_exact = is_same<Expected, detected_t<Op, Args...>>;
template <class Expected, template<class...> class Op, class... Args>
constexpr bool is_detected_exact_v
= is_detected_exact<Expected, Op, Args...>::value;
template <class To, template<class...> class Op, class... Args>
using is_detected_convertible = is_convertible<detected_t<Op, Args...>, To>;
template <class To, template<class...> class Op, class... Args>
constexpr bool is_detected_convertible_v
= is_detected_convertible<To, Op, Args...>::value;
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#if _LIBCPP_STD_VER > 11
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS
#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
// C++14 20.10.4.1, primary type categories
template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v
= is_void<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v
= is_null_pointer<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v
= is_integral<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v
= is_floating_point<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v
= is_array<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v
= is_pointer<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v
= is_lvalue_reference<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
= is_rvalue_reference<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
= is_member_object_pointer<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
= is_member_function_pointer<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v
= is_enum<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v
= is_union<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v
= is_class<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v
= is_function<_Tp>::value;
// C++14 20.10.4.2, composite type categories
template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v
= is_reference<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v
= is_arithmetic<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v
= is_fundamental<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v
= is_object<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v
= is_scalar<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
= is_compound<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v
= is_member_pointer<_Tp>::value;
// C++14 20.10.4.3, type properties
template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v
= is_const<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v
= is_volatile<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v
= is_trivial<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
= is_trivially_copyable<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v
= is_standard_layout<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v
= is_pod<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v
= is_literal_type<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
= is_empty<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v
= is_polymorphic<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
= is_abstract<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
= is_final<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v
= is_signed<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v
= is_unsigned<_Tp>::value;
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_constructible_v
= is_constructible<_Tp, _Ts...>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v
= is_default_constructible<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v
= is_copy_constructible<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v
= is_move_constructible<_Tp>::value;
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_assignable_v
= is_assignable<_Tp, _Up>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v
= is_copy_assignable<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v
= is_move_assignable<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v
= is_destructible<_Tp>::value;
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
= is_trivially_constructible<_Tp, _Ts...>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v
= is_trivially_default_constructible<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
= is_trivially_copy_constructible<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v
= is_trivially_move_constructible<_Tp>::value;
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v
= is_trivially_assignable<_Tp, _Up>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
= is_trivially_copy_assignable<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
= is_trivially_move_assignable<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
= is_trivially_destructible<_Tp>::value;
template <class _Tp, class ..._Ts> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
= is_nothrow_constructible<_Tp, _Ts...>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v
= is_nothrow_default_constructible<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
= is_nothrow_copy_constructible<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
= is_nothrow_move_constructible<_Tp>::value;
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v
= is_nothrow_assignable<_Tp, _Up>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
= is_nothrow_copy_assignable<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
= is_nothrow_move_assignable<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
= is_nothrow_destructible<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v
= has_virtual_destructor<_Tp>::value;
// C++14 20.10.5, type properties queries
template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v
= alignment_of<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v
= rank<_Tp>::value;
template <class _Tp, unsigned _Id = 0> _LIBCPP_CONSTEXPR size_t extent_v
= extent<_Tp, _Id>::value;
// C++14 20.10.6, type relations
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v
= is_same<_Tp, _Up>::value;
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_base_of_v
= is_base_of<_Tp, _Up>::value;
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_convertible_v
= is_convertible<_Tp, _Up>::value;
#endif /* _LIBCPP_HAS_NO_VARIABLE_TEMPLATES */
// 3.3.2, Other type transformations
/*
template <class>
class _LIBCPP_TEMPLATE_VIS raw_invocation_type;
template <class _Fn, class ..._Args>
class _LIBCPP_TEMPLATE_VIS raw_invocation_type<_Fn(_Args...)>;
template <class>
class _LIBCPP_TEMPLATE_VIS invokation_type;
template <class _Fn, class ..._Args>
class _LIBCPP_TEMPLATE_VIS invokation_type<_Fn(_Args...)>;
template <class _Tp>
using invokation_type_t = typename invokation_type<_Tp>::type;
template <class _Tp>
using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type;
*/
// 3.3.3, Logical operator traits
template <class...> using void_t = void;
template <class... _Args>
struct conjunction : _VSTD::__and_<_Args...> {};
template <class... _Args>
_LIBCPP_CONSTEXPR bool conjunction_v = conjunction<_Args...>::value;
template <class... _Args>
struct disjunction : _VSTD::__or_<_Args...> {};
template <class... _Args>
_LIBCPP_CONSTEXPR bool disjunction_v = disjunction<_Args...>::value;
template <class _Tp>
struct negation : _VSTD::__not_<_Tp> {};
template<class _Tp>
_LIBCPP_CONSTEXPR bool negation_v = negation<_Tp>::value;
// 3.3.4, Detection idiom
template <class...> using void_t = void;
struct nonesuch {
nonesuch() = delete;
~nonesuch() = delete;
nonesuch (nonesuch const&) = delete;
void operator=(nonesuch const&) = delete;
};
template <class _Default, class _AlwaysVoid, template <class...> class _Op, class... _Args>
struct _DETECTOR {
using value_t = false_type;
using type = _Default;
};
template <class _Default, template <class...> class _Op, class... _Args>
struct _DETECTOR<_Default, void_t<_Op<_Args...>>, _Op, _Args...> {
using value_t = true_type;
using type = _Op<_Args...>;
};
template <template<class...> class _Op, class... _Args>
using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
template <template<class...> class _Op, class... _Args>
using detected_t = typename _DETECTOR<nonesuch, void, _Op, _Args...>::type;
template <template<class...> class _Op, class... _Args>
_LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value;
template <class Default, template<class...> class _Op, class... _Args>
using detected_or = _DETECTOR<Default, void, _Op, _Args...>;
template <class Default, template<class...> class _Op, class... _Args>
using detected_or_t = typename detected_or<Default, _Op, _Args...>::type;
template <class Expected, template<class...> class _Op, class... _Args>
using is_detected_exact = is_same<Expected, detected_t<_Op, _Args...>>;
template <class Expected, template<class...> class _Op, class... _Args>
_LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<Expected, _Op, _Args...>::value;
template <class To, template<class...> class _Op, class... _Args>
using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, To>;
template <class To, template<class...> class _Op, class... _Args>
_LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<To, _Op, _Args...>::value;
_LIBCPP_END_NAMESPACE_LFTS
#endif /* _LIBCPP_STD_VER > 11 */
#endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */
|