⚝
One Hat Cyber Team
⚝
Your IP:
216.73.217.31
Server IP:
95.217.99.93
Server:
Linux sv1.sonichosted.com 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
include
/
c++
/
8
/
Edit File: type_traits
// C++11
-*- C++ -*- // Copyright (C) 2007-2018 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see //
. /** @file include/type_traits * This is a Standard C++ Library header. */ #ifndef _GLIBCXX_TYPE_TRAITS #define _GLIBCXX_TYPE_TRAITS 1 #pragma GCC system_header #if __cplusplus < 201103L # include
#else #include
namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup metaprogramming Metaprogramming * @ingroup utilities * * Template utilities for compile-time introspection and modification, * including type classification traits, type property inspection traits * and type transformation traits. * * @{ */ /// integral_constant template
struct integral_constant { static constexpr _Tp value = __v; typedef _Tp value_type; typedef integral_constant<_Tp, __v> type; constexpr operator value_type() const noexcept { return value; } #if __cplusplus > 201103L #define __cpp_lib_integral_constant_callable 201304 constexpr value_type operator()() const noexcept { return value; } #endif }; template
constexpr _Tp integral_constant<_Tp, __v>::value; /// The type used as a compile-time boolean with true value. typedef integral_constant
true_type; /// The type used as a compile-time boolean with false value. typedef integral_constant
false_type; template
using __bool_constant = integral_constant
; #if __cplusplus > 201402L # define __cpp_lib_bool_constant 201505 template
using bool_constant = integral_constant
; #endif // Meta programming helper types. template
struct conditional; template
struct __or_; template<> struct __or_<> : public false_type { }; template
struct __or_<_B1> : public _B1 { }; template
struct __or_<_B1, _B2> : public conditional<_B1::value, _B1, _B2>::type { }; template
struct __or_<_B1, _B2, _B3, _Bn...> : public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type { }; template
struct __and_; template<> struct __and_<> : public true_type { }; template
struct __and_<_B1> : public _B1 { }; template
struct __and_<_B1, _B2> : public conditional<_B1::value, _B2, _B1>::type { }; template
struct __and_<_B1, _B2, _B3, _Bn...> : public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type { }; template
struct __not_ : public __bool_constant { }; #if __cplusplus >= 201703L #define __cpp_lib_logical_traits 201510 template
struct conjunction : __and_<_Bn...> { }; template
struct disjunction : __or_<_Bn...> { }; template
struct negation : __not_<_Pp> { }; template
inline constexpr bool conjunction_v = conjunction<_Bn...>::value; template
inline constexpr bool disjunction_v = disjunction<_Bn...>::value; template
inline constexpr bool negation_v = negation<_Pp>::value; #endif // C++17 // 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 // them, because we need to derive from them as an implementation detail. template
struct __success_type { typedef _Tp type; }; struct __failure_type { }; // Primary type categories. template
struct remove_cv; template
struct __is_void_helper : public false_type { }; template<> struct __is_void_helper
: public true_type { }; /// is_void template
struct is_void : public __is_void_helper
::type>::type { }; template
struct __is_integral_helper : public false_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; #ifdef _GLIBCXX_USE_WCHAR_T template<> struct __is_integral_helper
: public true_type { }; #endif template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; template<> struct __is_integral_helper
: public true_type { }; // Conditionalizing on __STRICT_ANSI__ here will break any port that // uses one of these types for size_t. #if defined(__GLIBCXX_TYPE_INT_N_0) template<> struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0> : public true_type { }; template<> struct __is_integral_helper
: public true_type { }; #endif #if defined(__GLIBCXX_TYPE_INT_N_1) template<> struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1> : public true_type { }; template<> struct __is_integral_helper
: public true_type { }; #endif #if defined(__GLIBCXX_TYPE_INT_N_2) template<> struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2> : public true_type { }; template<> struct __is_integral_helper
: public true_type { }; #endif #if defined(__GLIBCXX_TYPE_INT_N_3) template<> struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3> : public true_type { }; template<> struct __is_integral_helper
: public true_type { }; #endif /// is_integral template
struct is_integral : public __is_integral_helper
::type>::type { }; template
struct __is_floating_point_helper : public false_type { }; template<> struct __is_floating_point_helper
: public true_type { }; template<> struct __is_floating_point_helper
: public true_type { }; template<> struct __is_floating_point_helper
: public true_type { }; #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) template<> struct __is_floating_point_helper<__float128> : public true_type { }; #endif /// is_floating_point template
struct is_floating_point : public __is_floating_point_helper
::type>::type { }; /// is_array template
struct is_array : public false_type { }; template
struct is_array<_Tp[_Size]> : public true_type { }; template
struct is_array<_Tp[]> : public true_type { }; template
struct __is_pointer_helper : public false_type { }; template
struct __is_pointer_helper<_Tp*> : public true_type { }; /// is_pointer template
struct is_pointer : public __is_pointer_helper
::type>::type { }; /// is_lvalue_reference template
struct is_lvalue_reference : public false_type { }; template
struct is_lvalue_reference<_Tp&> : public true_type { }; /// is_rvalue_reference template
struct is_rvalue_reference : public false_type { }; template
struct is_rvalue_reference<_Tp&&> : public true_type { }; template
struct is_function; template
struct __is_member_object_pointer_helper : public false_type { }; template
struct __is_member_object_pointer_helper<_Tp _Cp::*> : public integral_constant
::value> { }; /// is_member_object_pointer template
struct is_member_object_pointer : public __is_member_object_pointer_helper< typename remove_cv<_Tp>::type>::type { }; template
struct __is_member_function_pointer_helper : public false_type { }; template
struct __is_member_function_pointer_helper<_Tp _Cp::*> : public integral_constant
::value> { }; /// is_member_function_pointer template
struct is_member_function_pointer : public __is_member_function_pointer_helper< typename remove_cv<_Tp>::type>::type { }; /// is_enum template
struct is_enum : public integral_constant
{ }; /// is_union template
struct is_union : public integral_constant
{ }; /// is_class template
struct is_class : public integral_constant
{ }; /// is_function template
struct is_function : public false_type { }; template
struct is_function<_Res(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) & _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) && _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) & _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) && _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) const _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) const & _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) const && _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) const _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) const & _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) const && _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) volatile _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) volatile & _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) volatile && _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) volatile _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) volatile & _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) volatile && _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) const volatile _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) const volatile & _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes...) const volatile && _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) const volatile _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) const volatile & _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct is_function<_Res(_ArgTypes......) const volatile && _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; #define __cpp_lib_is_null_pointer 201309 template
struct __is_null_pointer_helper : public false_type { }; template<> struct __is_null_pointer_helper
: public true_type { }; /// is_null_pointer (LWG 2247). template
struct is_null_pointer : public __is_null_pointer_helper
::type>::type { }; /// __is_nullptr_t (extension). template
struct __is_nullptr_t : public is_null_pointer<_Tp> { }; // Composite type categories. /// is_reference template
struct is_reference : public __or_
, is_rvalue_reference<_Tp>>::type { }; /// is_arithmetic template
struct is_arithmetic : public __or_
, is_floating_point<_Tp>>::type { }; /// is_fundamental template
struct is_fundamental : public __or_
, is_void<_Tp>, is_null_pointer<_Tp>>::type { }; /// is_object template
struct is_object : public __not_<__or_
, is_reference<_Tp>, is_void<_Tp>>>::type { }; template
struct is_member_pointer; /// is_scalar template
struct is_scalar : public __or_
, is_enum<_Tp>, is_pointer<_Tp>, is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type { }; /// is_compound template
struct is_compound : public integral_constant
::value> { }; template
struct __is_member_pointer_helper : public false_type { }; template
struct __is_member_pointer_helper<_Tp _Cp::*> : public true_type { }; /// is_member_pointer template
struct is_member_pointer : public __is_member_pointer_helper
::type>::type { }; // Utility to detect referenceable types ([defns.referenceable]). template
struct __is_referenceable : public __or_
, is_reference<_Tp>>::type { }; template
struct __is_referenceable<_Res(_Args...) _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; template
struct __is_referenceable<_Res(_Args......) _GLIBCXX_NOEXCEPT_QUAL> : public true_type { }; // Type properties. /// is_const template
struct is_const : public false_type { }; template
struct is_const<_Tp const> : public true_type { }; /// is_volatile template
struct is_volatile : public false_type { }; template
struct is_volatile<_Tp volatile> : public true_type { }; /// is_trivial template
struct is_trivial : public integral_constant
{ }; // is_trivially_copyable template
struct is_trivially_copyable : public integral_constant
{ }; /// is_standard_layout template
struct is_standard_layout : public integral_constant
{ }; /// is_pod // Could use is_standard_layout && is_trivial instead of the builtin. template
struct is_pod : public integral_constant
{ }; /// is_literal_type template
struct is_literal_type : public integral_constant
{ }; /// is_empty template
struct is_empty : public integral_constant
{ }; /// is_polymorphic template
struct is_polymorphic : public integral_constant
{ }; #if __cplusplus >= 201402L #define __cpp_lib_is_final 201402L /// is_final template
struct is_final : public integral_constant
{ }; #endif /// is_abstract template
struct is_abstract : public integral_constant
{ }; template
::value> struct __is_signed_helper : public false_type { }; template
struct __is_signed_helper<_Tp, true> : public integral_constant
{ }; /// is_signed template
struct is_signed : public __is_signed_helper<_Tp>::type { }; /// is_unsigned template
struct is_unsigned : public __and_
, __not_
>> { }; // Destructible and constructible type properties. /** * @brief Utility to simplify expressions used in unevaluated operands * @ingroup utilities */ template
_Up __declval(int); template
_Tp __declval(long); template
auto declval() noexcept -> decltype(__declval<_Tp>(0)); template
struct extent; template
struct remove_all_extents; template
struct __is_array_known_bounds : public integral_constant
::value > 0)> { }; template
struct __is_array_unknown_bounds : public __and_
, __not_
>> { }; // In N3290 is_destructible does not say anything about function // types and abstract types, see LWG 2049. This implementation // describes function types as non-destructible and all complete // object types as destructible, iff the explicit destructor // call expression is wellformed. struct __do_is_destructible_impl { template
().~_Tp())> static true_type __test(int); template
static false_type __test(...); }; template
struct __is_destructible_impl : public __do_is_destructible_impl { typedef decltype(__test<_Tp>(0)) type; }; template
, __is_array_unknown_bounds<_Tp>, is_function<_Tp>>::value, bool = __or_
, is_scalar<_Tp>>::value> struct __is_destructible_safe; template
struct __is_destructible_safe<_Tp, false, false> : public __is_destructible_impl
::type>::type { }; template
struct __is_destructible_safe<_Tp, true, false> : public false_type { }; template
struct __is_destructible_safe<_Tp, false, true> : public true_type { }; /// is_destructible template
struct is_destructible : public __is_destructible_safe<_Tp>::type { }; // is_nothrow_destructible requires that is_destructible is // satisfied as well. We realize that by mimicing the // implementation of is_destructible but refer to noexcept(expr) // instead of decltype(expr). struct __do_is_nt_destructible_impl { template
static integral_constant
().~_Tp())> __test(int); template
static false_type __test(...); }; template
struct __is_nt_destructible_impl : public __do_is_nt_destructible_impl { typedef decltype(__test<_Tp>(0)) type; }; template
, __is_array_unknown_bounds<_Tp>, is_function<_Tp>>::value, bool = __or_
, is_scalar<_Tp>>::value> struct __is_nt_destructible_safe; template
struct __is_nt_destructible_safe<_Tp, false, false> : public __is_nt_destructible_impl
::type>::type { }; template
struct __is_nt_destructible_safe<_Tp, true, false> : public false_type { }; template
struct __is_nt_destructible_safe<_Tp, false, true> : public true_type { }; /// is_nothrow_destructible template
struct is_nothrow_destructible : public __is_nt_destructible_safe<_Tp>::type { }; /// is_constructible template
struct is_constructible : public __bool_constant<__is_constructible(_Tp, _Args...)> { }; /// is_default_constructible template
struct is_default_constructible : public is_constructible<_Tp>::type { }; template
::value> struct __is_copy_constructible_impl; template
struct __is_copy_constructible_impl<_Tp, false> : public false_type { }; template
struct __is_copy_constructible_impl<_Tp, true> : public is_constructible<_Tp, const _Tp&> { }; /// is_copy_constructible template
struct is_copy_constructible : public __is_copy_constructible_impl<_Tp> { }; template
::value> struct __is_move_constructible_impl; template
struct __is_move_constructible_impl<_Tp, false> : public false_type { }; template
struct __is_move_constructible_impl<_Tp, true> : public is_constructible<_Tp, _Tp&&> { }; /// is_move_constructible template
struct is_move_constructible : public __is_move_constructible_impl<_Tp> { }; template
struct __is_nt_constructible_impl : public false_type { }; template
struct __is_nt_constructible_impl
: public __bool_constant
()...))> { }; template
struct __is_nt_constructible_impl
: public __bool_constant
(std::declval<_Arg>()))> { }; template
struct __is_nt_constructible_impl
: public __bool_constant
{ }; template
struct __is_nt_constructible_impl
: public __bool_constant
::type())> { }; template
using __is_nothrow_constructible_impl = __is_nt_constructible_impl<__is_constructible(_Tp, _Args...), _Tp, _Args...>; /// is_nothrow_constructible template
struct is_nothrow_constructible : public __is_nothrow_constructible_impl<_Tp, _Args...>::type { }; /// is_nothrow_default_constructible template
struct is_nothrow_default_constructible : public __is_nothrow_constructible_impl<_Tp>::type { }; template
::value> struct __is_nothrow_copy_constructible_impl; template
struct __is_nothrow_copy_constructible_impl<_Tp, false> : public false_type { }; template
struct __is_nothrow_copy_constructible_impl<_Tp, true> : public is_nothrow_constructible<_Tp, const _Tp&> { }; /// is_nothrow_copy_constructible template
struct is_nothrow_copy_constructible : public __is_nothrow_copy_constructible_impl<_Tp> { }; template
::value> struct __is_nothrow_move_constructible_impl; template
struct __is_nothrow_move_constructible_impl<_Tp, false> : public false_type { }; template
struct __is_nothrow_move_constructible_impl<_Tp, true> : public is_nothrow_constructible<_Tp, _Tp&&> { }; /// is_nothrow_move_constructible template
struct is_nothrow_move_constructible : public __is_nothrow_move_constructible_impl<_Tp> { }; /// is_assignable template
struct is_assignable : public __bool_constant<__is_assignable(_Tp, _Up)> { }; template
::value> struct __is_copy_assignable_impl; template
struct __is_copy_assignable_impl<_Tp, false> : public false_type { }; template
struct __is_copy_assignable_impl<_Tp, true> : public is_assignable<_Tp&, const _Tp&> { }; /// is_copy_assignable template
struct is_copy_assignable : public __is_copy_assignable_impl<_Tp> { }; template
::value> struct __is_move_assignable_impl; template
struct __is_move_assignable_impl<_Tp, false> : public false_type { }; template
struct __is_move_assignable_impl<_Tp, true> : public is_assignable<_Tp&, _Tp&&> { }; /// is_move_assignable template
struct is_move_assignable : public __is_move_assignable_impl<_Tp> { }; template
struct __is_nt_assignable_impl : public integral_constant
() = declval<_Up>())> { }; /// is_nothrow_assignable template
struct is_nothrow_assignable : public __and_
, __is_nt_assignable_impl<_Tp, _Up>> { }; template
::value> struct __is_nt_copy_assignable_impl; template
struct __is_nt_copy_assignable_impl<_Tp, false> : public false_type { }; template
struct __is_nt_copy_assignable_impl<_Tp, true> : public is_nothrow_assignable<_Tp&, const _Tp&> { }; /// is_nothrow_copy_assignable template
struct is_nothrow_copy_assignable : public __is_nt_copy_assignable_impl<_Tp> { }; template
::value> struct __is_nt_move_assignable_impl; template
struct __is_nt_move_assignable_impl<_Tp, false> : public false_type { }; template
struct __is_nt_move_assignable_impl<_Tp, true> : public is_nothrow_assignable<_Tp&, _Tp&&> { }; /// is_nothrow_move_assignable template