28 #ifndef YB_INC_ystdex_type_op_hpp_
29 #define YB_INC_ystdex_type_op_hpp_ 1
37 using std::tr1::add_reference;
39 using std::tr1::has_nothrow_assign;
40 using std::tr1::has_nothrow_constructor;
41 using std::tr1::has_nothrow_copy;
42 using std::tr1::has_trivial_assign;
43 using std::tr1::has_trivial_constructor;
44 using std::tr1::has_trivial_copy;
45 using std::tr1::has_trivial_destructor;
48 using std::integral_constant;
50 using std::false_type;
53 using std::is_integral;
54 using std::is_floating_point;
56 using std::is_pointer;
57 using std::is_lvalue_reference;
58 using std::is_rvalue_reference;
59 using std::is_member_object_pointer;
60 using std::is_member_function_pointer;
64 using std::is_function;
66 using std::is_reference;
67 using std::is_arithmetic;
68 using std::is_fundamental;
71 using std::is_compound;
72 using std::is_member_pointer;
75 using std::is_volatile;
76 using std::is_trivial;
78 using std::is_standard_layout;
80 using std::is_literal_type;
82 using std::is_polymorphic;
83 using std::is_abstract;
86 using std::is_unsigned;
88 using std::is_constructible;
90 using std::is_default_constructible;
91 using std::is_copy_constructible;
92 using std::is_move_constructible;
94 using std::is_assignable;
95 using std::is_copy_assignable;
96 using std::is_move_assignable;
98 using std::is_destructible;
100 using std::is_trivially_constructible;
101 using std::is_trivially_default_constructible;
102 using std::is_trivially_copy_constructible;
103 using std::is_trivially_move_constructible;
105 using std::is_trivially_assignable;
106 using std::is_trivially_copy_assignable;
107 using std::is_trivially_move_assignable;
108 using std::is_trivially_destructible;
110 using std::is_nothrow_constructible;
111 using std::is_nothrow_default_constructible;
112 using std::is_nothrow_copy_constructible;
113 using std::is_nothrow_move_constructible;
115 using std::is_nothrow_assignable;
116 using std::is_nothrow_copy_assignable;
117 using std::is_nothrow_move_assignable;
119 using std::is_nothrow_destructible;
121 using std::has_virtual_destructor;
123 using std::alignment_of;
128 using std::is_base_of;
129 using std::is_convertible;
131 using std::remove_const;
132 using std::remove_volatile;
133 using std::remove_cv;
134 using std::add_const;
135 using std::add_volatile;
138 using std::remove_reference;
139 using std::add_lvalue_reference;
140 using std::add_rvalue_reference;
142 using std::make_signed;
143 using std::make_unsigned;
145 using std::remove_extent;
146 using std::remove_all_extents;
148 using std::remove_pointer;
149 using std::add_pointer;
151 using std::aligned_storage;
154 using std::enable_if;
155 using std::conditional;
156 using std::common_type;
158 using std::underlying_type;
159 using std::result_of;
215 template<
typename _type>
218 template<
typename _type>
221 template<
typename _type>
224 template<
typename _type>
227 template<
typename _type>
230 template<
typename _type>
233 template<
typename _type>
236 template<
typename _type>
239 template<
typename _type>
242 template<
typename _type>
245 template<
typename _type>
248 template<
typename _type>
251 template<
typename _type>
254 template<
typename _type>
257 template<
typename _type>
260 template<
size_t _vLen,
261 size_t _vAlign =
yalignof(
typename aligned_storage<_vLen>::type)>
270 template<
typename _type>
273 template<
bool _bCond,
typename _type =
void>
276 template<
bool _bCond,
typename _type,
typename _type2>
279 template<
typename... _types>
282 template<
typename _type>
285 template<
typename _type>
298 template<
typename _type>
300 && !is_abstract<_type>::value && !is_function<_type>::value>
309 template<
typename _type>
311 : integral_constant<bool, !is_same<decay_t<_type>, _type>::value>
320 template<
typename _type>
322 && is_class<remove_pointer_t<_type>>::value>
331 template<
typename _type>
333 _type>::value && is_class<remove_reference_t<_type>>::value>
343 template<
typename _type>
345 _type>::value && is_class<typename remove_reference<_type>::type>::value>
355 template<
typename _type>
357 is_pod<_type>::value && is_class<_type>::value>
367 template<
typename _type>
369 is_pod<_type>::value && is_union<_type>::value>
378 template<
typename _tFrom,
typename _tTo>
388 template<
typename _tFrom,
typename _tTo>
396 #ifdef YB_IMPL_GNUCPP
397 # if YB_IMPL_GNUCPP >= 40600
398 # pragma GCC diagnostic push
399 # pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
401 # pragma GCC system_header
416 #define YB_HAS_MEMBER(_n) \
417 template<class _type> \
418 struct has_mem_##_n \
421 template<typename _type2> \
422 static std::true_type \
423 test(ystdex::empty_base<typename _type2::_n>*); \
424 template<typename _type2> \
425 static std::false_type \
429 static yconstexpr bool value = decltype(test<_type>(nullptr))::value; \
448 #define YB_TYPE_OP_TEST_2(_n, _expr) \
449 template<typename _type1, typename _type2> \
453 template<typename _type> \
454 static std::true_type \
455 test(ystdex::enable_if_t<(_expr), int>); \
457 static std::false_type \
461 static yconstexpr bool value = decltype(test<_type1>(0))::value; \
471 _type>() == std::declval<_type2>()),
bool>::value))
476 std::declval<_type2>()])>::value)
479 #if YB_IMPL_GNUCPP && YB_IMPL_GNUCPP >= 40600
481 # pragma GCC diagnostic pop
488 template<
class _type>
491 static_assert(std::is_class<_type>::value,
492 "Non-class type found @ ystdex::has_nonempty_virtual_base;");
522 template<
class _type1,
class _type2>
525 static_assert(std::is_class<_type1>::value
526 && std::is_class<_type2>::value,
527 "Non-class type found @ ystdex::has_common_nonempty_virtual_base;");
530 struct A :
virtual _type1
537 #ifdef YB_IMPL_GNUCPP
538 # if YB_IMPL_GNUCPP >= 40600
539 # pragma GCC diagnostic push
540 # pragma GCC diagnostic ignored "-Wextra"
542 # pragma GCC system_header
546 struct B :
virtual _type2
559 #if YB_IMPL_GNUCPP && YB_IMPL_GNUCPP >= 40600
561 # pragma GCC diagnostic pop
578 template<
class _type>
580 details::has_mem_value<remove_cv_t<_type>>::value>
590 template<
typename _type1,
typename _type2>
600 template<
typename _type1,
typename _type2>
602 details::have_equality_operator<_type1, _type2>::value>
611 template<
class _type>
613 details::have_nonempty_virtual_base<_type>::value>
622 template<
class _type1,
class _type2>
624 details::have_common_nonempty_virtual_base<_type1, _type2>::value>
642 template<
typename _type>
656 template<
typename _type>
663 template<
typename _type>
674 template<
typename _type>
686 template<
typename _type>
700 template<
typename _type>
715 template<
typename _type>
736 template<
typename _type>
742 template<
typename _type>
749 template<
typename _type>
764 template<
class _tClass,
typename _tParam,
typename _type =
int>
typename make_unsigned< _type >::type make_unsigned_t
#define YB_HAS_MEMBER(_n)
测试包含指定名称的嵌套成员。
#define YB_TYPE_OP_TEST_2(_n, _expr)
测试包含指定的 2 个类型的表达式是否合式。
remove_cv_t< remove_reference_t< _type >> type
typename add_pointer< _type >::type add_pointer_t
typename add_lvalue_reference< _type >::type add_lvalue_reference_t
typename remove_reference< _type >::type remove_reference_t
typename result_of< _type >::type result_of_t
typename conditional< _bCond, _type, _type2 >::type conditional_t
typename underlying_type< _type >::type underlying_type_t
typename remove_extent< _type >::type remove_extent_t
typename remove_volatile< _type >::type remove_volatile_t
typename decay< _type >::type decay_t
typename add_rvalue_reference< _type >::type add_rvalue_reference_t
typename remove_pointer< _type >::type remove_pointer_t
移除可能被 cv-qualifier 修饰的引用和指针类型。
typename remove_all_extents< _type >::type remove_all_extents_t
typename add_volatile< _type >::type add_volatile_t
typename remove_rcv< _type >::type remove_rcv_t
remove_pointer_t< remove_reference_t< _type >> type
typename make_signed< _type >::type make_signed_t
判断是否存在合式的结果可转换为 bool 类型的 == 操作符接受指定类型的表达式。
typename aligned_storage< _vLen, _vAlign >::type aligned_storage_t
#define yalignof(_type)
指定特定类型的对齐。
typename remove_cv< _type >::type remove_cv_t
typename array_decay< _type >::type type
typename array_decay< _type >::type type
enable_if_t<!is_same< _tClass &, remove_rcv_t< _tParam > & >::value, _type > exclude_self_ctor_t
移除选择类类型的特定重载避免构造模板和复制/转移构造函数冲突。
typename array_decay< _type >::type type
conditional_t< is_function< value_type >::value||is_array< value_type >::value, decay_t< _type >, _type > type
remove_reference_t< _type > value_type
#define yconstexpr
指定编译时常量表达式。
remove_cv_t< typename remove_rp< _type >::type > type
typename add_cv< _type >::type add_cv_t
conditional_t< is_array< _type >::value, decay_t< _type >, _type > type
typename enable_if< _bCond, _type >::type enable_if_t
typename remove_const< _type >::type remove_const_t
ISO C++ 1y 兼容类型操作别名。
移除可能被 cv-qualifier 修饰的引用类型。
typename common_type< _types...>::type common_type_t
typename add_const< _type >::type add_const_t