1 2#ifndef DEFINE_BASE 3#define DEFINE_BASE(Name) ::ArchetypeBases::NullBase 4#endif 5#ifndef DEFINE_EXPLICIT 6#define DEFINE_EXPLICIT 7#endif 8#ifndef DEFINE_CONSTEXPR 9#define DEFINE_CONSTEXPR constexpr 10#endif 11#ifndef DEFINE_ASSIGN_CONSTEXPR 12#if TEST_STD_VER >= 14 13#define DEFINE_ASSIGN_CONSTEXPR DEFINE_CONSTEXPR 14#else 15#define DEFINE_ASSIGN_CONSTEXPR 16#endif 17#endif 18#ifndef DEFINE_CTOR 19#define DEFINE_CTOR = default 20#endif 21#ifndef DEFINE_DEFAULT_CTOR 22#define DEFINE_DEFAULT_CTOR DEFINE_CTOR 23#endif 24#ifndef DEFINE_ASSIGN 25#define DEFINE_ASSIGN = default 26#endif 27#ifndef DEFINE_DTOR 28#define DEFINE_DTOR(Name) 29#endif 30 31struct AllCtors : DEFINE_BASE(AllCtors) { 32 using Base = DEFINE_BASE(AllCtors); 33 using Base::Base; 34 using Base::operator=; 35 DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors() DEFINE_DEFAULT_CTOR; 36 DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors(AllCtors const&) DEFINE_CTOR; 37 DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors(AllCtors &&) DEFINE_CTOR; 38 DEFINE_ASSIGN_CONSTEXPR AllCtors& operator=(AllCtors const&) DEFINE_ASSIGN; 39 DEFINE_ASSIGN_CONSTEXPR AllCtors& operator=(AllCtors &&) DEFINE_ASSIGN; 40 DEFINE_DTOR(AllCtors) 41}; 42 43struct NoCtors : DEFINE_BASE(NoCtors) { 44 using Base = DEFINE_BASE(NoCtors); 45 DEFINE_EXPLICIT NoCtors() = delete; 46 DEFINE_EXPLICIT NoCtors(NoCtors const&) = delete; 47 NoCtors& operator=(NoCtors const&) = delete; 48 DEFINE_DTOR(NoCtors) 49}; 50 51struct NoDefault : DEFINE_BASE(NoDefault) { 52 using Base = DEFINE_BASE(NoDefault); 53 using Base::Base; 54 DEFINE_EXPLICIT DEFINE_CONSTEXPR NoDefault() = delete; 55 DEFINE_DTOR(NoDefault) 56}; 57 58struct DefaultOnly : DEFINE_BASE(DefaultOnly) { 59 using Base = DEFINE_BASE(DefaultOnly); 60 using Base::Base; 61 DEFINE_EXPLICIT DEFINE_CONSTEXPR DefaultOnly() DEFINE_DEFAULT_CTOR; 62 DefaultOnly(DefaultOnly const&) = delete; 63 DefaultOnly& operator=(DefaultOnly const&) = delete; 64 DEFINE_DTOR(DefaultOnly) 65}; 66 67struct Copyable : DEFINE_BASE(Copyable) { 68 using Base = DEFINE_BASE(Copyable); 69 using Base::Base; 70 DEFINE_EXPLICIT DEFINE_CONSTEXPR Copyable() DEFINE_DEFAULT_CTOR; 71 DEFINE_EXPLICIT DEFINE_CONSTEXPR Copyable(Copyable const &) DEFINE_CTOR; 72 Copyable &operator=(Copyable const &) DEFINE_ASSIGN; 73 DEFINE_DTOR(Copyable) 74}; 75 76struct CopyOnly : DEFINE_BASE(CopyOnly) { 77 using Base = DEFINE_BASE(CopyOnly); 78 using Base::Base; 79 DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly() DEFINE_DEFAULT_CTOR; 80 DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly(CopyOnly const &) DEFINE_CTOR; 81 DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly(CopyOnly &&) = delete; 82 CopyOnly &operator=(CopyOnly const &) DEFINE_ASSIGN; 83 CopyOnly &operator=(CopyOnly &&) = delete; 84 DEFINE_DTOR(CopyOnly) 85}; 86 87struct NonCopyable : DEFINE_BASE(NonCopyable) { 88 using Base = DEFINE_BASE(NonCopyable); 89 using Base::Base; 90 DEFINE_EXPLICIT DEFINE_CONSTEXPR NonCopyable() DEFINE_DEFAULT_CTOR; 91 DEFINE_EXPLICIT DEFINE_CONSTEXPR NonCopyable(NonCopyable const &) = delete; 92 NonCopyable &operator=(NonCopyable const &) = delete; 93 DEFINE_DTOR(NonCopyable) 94}; 95 96struct MoveOnly : DEFINE_BASE(MoveOnly) { 97 using Base = DEFINE_BASE(MoveOnly); 98 using Base::Base; 99 DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveOnly() DEFINE_DEFAULT_CTOR; 100 DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveOnly(MoveOnly &&) DEFINE_CTOR; 101 MoveOnly &operator=(MoveOnly &&) DEFINE_ASSIGN; 102 DEFINE_DTOR(MoveOnly) 103}; 104 105struct CopyAssignable : DEFINE_BASE(CopyAssignable) { 106 using Base = DEFINE_BASE(CopyAssignable); 107 using Base::Base; 108 DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyAssignable() = delete; 109 CopyAssignable& operator=(CopyAssignable const&) DEFINE_ASSIGN; 110 DEFINE_DTOR(CopyAssignable) 111}; 112 113struct CopyAssignOnly : DEFINE_BASE(CopyAssignOnly) { 114 using Base = DEFINE_BASE(CopyAssignOnly); 115 using Base::Base; 116 DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyAssignOnly() = delete; 117 CopyAssignOnly& operator=(CopyAssignOnly const&) DEFINE_ASSIGN; 118 CopyAssignOnly& operator=(CopyAssignOnly &&) = delete; 119 DEFINE_DTOR(CopyAssignOnly) 120}; 121 122struct MoveAssignOnly : DEFINE_BASE(MoveAssignOnly) { 123 using Base = DEFINE_BASE(MoveAssignOnly); 124 using Base::Base; 125 DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveAssignOnly() = delete; 126 MoveAssignOnly& operator=(MoveAssignOnly const&) = delete; 127 MoveAssignOnly& operator=(MoveAssignOnly &&) DEFINE_ASSIGN; 128 DEFINE_DTOR(MoveAssignOnly) 129}; 130 131struct ConvertingType : DEFINE_BASE(ConvertingType) { 132 using Base = DEFINE_BASE(ConvertingType); 133 using Base::Base; 134 DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType() DEFINE_DEFAULT_CTOR; 135 DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(ConvertingType const&) DEFINE_CTOR; 136 DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(ConvertingType &&) DEFINE_CTOR; 137 ConvertingType& operator=(ConvertingType const&) DEFINE_ASSIGN; 138 ConvertingType& operator=(ConvertingType &&) DEFINE_ASSIGN; 139 template <class ...Args> 140 DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(Args&&...) {} 141 template <class Arg> 142 ConvertingType& operator=(Arg&&) { return *this; } 143 DEFINE_DTOR(ConvertingType) 144}; 145 146template <template <class...> class List> 147using ApplyTypes = List< 148 AllCtors, 149 NoCtors, 150 NoDefault, 151 DefaultOnly, 152 Copyable, 153 CopyOnly, 154 NonCopyable, 155 MoveOnly, 156 CopyAssignable, 157 CopyAssignOnly, 158 MoveAssignOnly, 159 ConvertingType 160 >; 161 162#undef DEFINE_BASE 163#undef DEFINE_EXPLICIT 164#undef DEFINE_CONSTEXPR 165#undef DEFINE_ASSIGN_CONSTEXPR 166#undef DEFINE_CTOR 167#undef DEFINE_DEFAULT_CTOR 168#undef DEFINE_ASSIGN 169#undef DEFINE_DTOR 170