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