57 public:
operator Base() {
return base; }
65 A(
int a =0) : a_{a} { };
66 A(
const A&) =
default;
75 B(
int b =0) : b_{b} { };
76 B(
const B&) =
default;
78 B& operator= (
const B&) =
default;
79 B& operator= (B&&) =
default;
94 EXPECT_EQ (
true, (Same<double&, double&>));
96 EXPECT_EQ (
false, (Same<Base, Derived1>));
101 EXPECT_EQ (
true, (DerivedFrom<Derived1, Base>));
102 EXPECT_EQ (
true, (DerivedFrom<Derived2, Derived1>));
103 EXPECT_EQ (
true, (DerivedFrom<Derived2, Base>));
104 EXPECT_EQ (
false, (DerivedFrom<Base, Derived1>));
105 EXPECT_EQ (
false, (DerivedFrom<Base, int>));
106 EXPECT_EQ (
false, (DerivedFrom<void, int>));
111 EXPECT_EQ (
true, (ConvertibleTo<void, void>));
112 EXPECT_EQ (
false, (ConvertibleTo<Base, void>));
113 EXPECT_EQ (
false, (ConvertibleTo<Base*, Derived1*>));
114 EXPECT_EQ (
true, (ConvertibleTo<Derived1*, Base*>));
115 EXPECT_EQ (
true, (ConvertibleTo<HaveOperatorBase, Base>));
116 EXPECT_EQ (
true, (ConvertibleTo<Base, HavePerfectForwarding>));
121 EXPECT_EQ (
true, (CommonReference<Derived1, Base>));
122 EXPECT_EQ (
true, (CommonReference<Derived1&, Base>));
123 EXPECT_EQ (
true, (CommonReference<const Empty&&, const Empty&>));
124 EXPECT_EQ (
false, (CommonReference<Empty&, const volatile Empty&>));
130 EXPECT_EQ (
true, (Common<Base, Derived1>));
131 EXPECT_EQ (
true, (Common<Derived1, Derived2>));
132 EXPECT_EQ (
true, (Common<Base, HaveOperatorBase>));
133 EXPECT_EQ (
true, (Common<Base, HavePerfectForwarding>));
147 EXPECT_EQ (
false, (SignedIntegral<void>));
149 EXPECT_EQ (
false, (SignedIntegral<int*>));
150 EXPECT_EQ (
false, (SignedIntegral<unsigned long>));
151 EXPECT_EQ (
false, (SignedIntegral<double>));
152 EXPECT_EQ (
false, (SignedIntegral<Base>));
156 EXPECT_EQ (
false, (UnsignedIntegral<void>));
157 EXPECT_EQ (
true, (UnsignedIntegral<unsigned int>));
158 EXPECT_EQ (
false, (UnsignedIntegral<long>));
159 EXPECT_EQ (
false, (UnsignedIntegral<double>));
160 EXPECT_EQ (
false, (UnsignedIntegral<Base>));
166 EXPECT_EQ (
false, (MoveAssignable<void>));
167 EXPECT_EQ (
true, (MoveAssignable<void*>));
169 EXPECT_EQ (
true, (MoveAssignable<int*>));
170 EXPECT_EQ (
false, (MoveAssignable<HaveOnlyCopy>));
171 EXPECT_EQ (
true, (MoveAssignable<HaveOnlyMove>));
172 EXPECT_EQ (
true, (MoveAssignable<HaveCopyAndMove>));
173 EXPECT_EQ (
true, (MoveAssignable<Empty>));
174 EXPECT_EQ (
true, (MoveAssignable<HavePerfectForwarding>));
177 EXPECT_EQ (
false, (CopyAssignable<void>));
178 EXPECT_EQ (
true, (CopyAssignable<void*>));
180 EXPECT_EQ (
true, (CopyAssignable<int*>));
181 EXPECT_EQ (
true, (CopyAssignable<HaveOnlyCopy>));
182 EXPECT_EQ (
false, (CopyAssignable<HaveOnlyMove>));
183 EXPECT_EQ (
true, (CopyAssignable<HaveCopyAndMove>));
184 EXPECT_EQ (
true, (CopyAssignable<Empty>));
185 EXPECT_EQ (
true, (CopyAssignable<HavePerfectForwarding>));
188 EXPECT_EQ (
false, (Assignable<void, void>));
189 EXPECT_EQ (
false, (Assignable<int&, void>));
190 EXPECT_EQ (
true, (Assignable<int&, int>));
191 EXPECT_EQ (
false, (Assignable<int, int>));
192 EXPECT_EQ (
false, (Assignable<int*, int*>));
193 EXPECT_EQ (
true, (Assignable<Base&, Derived1>));
194 EXPECT_EQ (
false, (Assignable<Derived1&, Base>));
195 EXPECT_EQ (
true, (Assignable<HaveOnlyMove&, HaveOnlyMove&&>));
196 EXPECT_EQ (
true , (Assignable<HaveOnlyMove&, HaveOnlyMove>));
197 EXPECT_EQ (
true, (Assignable<Empty&, Empty>));
206 EXPECT_EQ (
true, (SwappableWith<int, int>));
207 EXPECT_EQ (
false, (SwappableWith<int, Base>));
208 EXPECT_EQ (
false, (SwappableWith<Base, Derived1>));
216 EXPECT_EQ (
true, (Destructible<HavePerfectForwarding>));
221 EXPECT_EQ (
false, (Constructible<void>));
222 EXPECT_EQ (
true, (Constructible<void*>));
224 EXPECT_EQ (
false, (Constructible<HaveOnlyMove>));
225 EXPECT_EQ (
true, (Constructible<HavePerfectForwarding, int>));
228 EXPECT_EQ (
false, (DefaultConstructible<void>));
229 EXPECT_EQ (
true, (DefaultConstructible<void*>));
230 EXPECT_EQ (
false, (DefaultConstructible<int&>));
231 EXPECT_EQ (
true, (DefaultConstructible<Base>));
232 EXPECT_EQ (
true, (DefaultConstructible<Derived1>));
233 EXPECT_EQ (
false, (DefaultConstructible<HaveOnlyCopy>));
234 EXPECT_EQ (
false, (DefaultConstructible<HaveOnlyMove>));
235 EXPECT_EQ (
false, (DefaultConstructible<HavePerfectForwarding>));
238 EXPECT_EQ (
false, (MoveConstructible<void>));
239 EXPECT_EQ (
true, (MoveConstructible<void*>));
240 EXPECT_EQ (
true, (MoveConstructible<Base>));
241 EXPECT_EQ (
true, (MoveConstructible<Derived1>));
242 EXPECT_EQ (
true, (MoveConstructible<HaveOnlyMove>));
243 EXPECT_EQ (
false, (MoveConstructible<HaveOnlyCopy>));
244 EXPECT_EQ (
true, (MoveConstructible<HaveCopyAndMove>));
245 EXPECT_EQ (
true , (MoveConstructible<HavePerfectForwarding>));
248 EXPECT_EQ (
false, (CopyConstructible<void>));
249 EXPECT_EQ (
true, (CopyConstructible<void*>));
250 EXPECT_EQ (
true, (CopyConstructible<Base>));
251 EXPECT_EQ (
true, (CopyConstructible<Derived1>));
252 EXPECT_EQ (
false, (CopyConstructible<HaveOnlyMove>));
253 EXPECT_EQ (
false, (CopyConstructible<HaveOnlyCopy>));
254 EXPECT_EQ (
true, (CopyConstructible<HaveCopyAndMove>));
255 EXPECT_EQ (
true , (CopyConstructible<HavePerfectForwarding>));
258 TEST(TConcepts, MovableCopyable) {
264 EXPECT_EQ (
true, (Movable<HaveOnlyMove>));
265 EXPECT_EQ (
false, (Movable<HaveOnlyCopy>));
266 EXPECT_EQ (
true, (Movable<HaveCopyAndMove>));
267 EXPECT_EQ (
true , (Movable<HavePerfectForwarding>));
274 EXPECT_EQ (
false, (Copyable<HaveOnlyMove>));
275 EXPECT_EQ (
false, (Copyable<HaveOnlyCopy>));
276 EXPECT_EQ (
true, (Copyable<HaveCopyAndMove>));
277 EXPECT_EQ (
true , (Copyable<HavePerfectForwarding>));
286 EXPECT_EQ (
true, (Boolean<std::true_type>));
287 EXPECT_EQ (
true, (Boolean<meta::true_>));
293 EXPECT_EQ (
false, (EqualityComparable<void>));
294 EXPECT_EQ (
true, (EqualityComparable<bool>));
295 EXPECT_EQ (
true, (EqualityComparable<int>));
296 EXPECT_EQ (
false, (EqualityComparable<Empty>));
297 EXPECT_EQ (
true, (EqualityComparable<A>));
300 EXPECT_EQ (
false, (EqualityComparableWith<void, bool>));
301 EXPECT_EQ (
false, (EqualityComparableWith<void, void>));
302 EXPECT_EQ (
true, (EqualityComparableWith<bool, bool>));
303 EXPECT_EQ (
true, (EqualityComparableWith<int, int>));
304 EXPECT_EQ (
true, (EqualityComparableWith<int, bool>));
305 EXPECT_EQ (
false, (EqualityComparableWith<Empty, Empty>));
306 EXPECT_EQ (
false, (EqualityComparableWith<int, Empty>));
307 EXPECT_EQ (
true, (EqualityComparableWith<A, A>));
308 EXPECT_EQ (
false, (EqualityComparableWith<A, B>));
311 EXPECT_EQ (
false, (StrictTotallyOrdered<void>));
312 EXPECT_EQ (
true, (StrictTotallyOrdered<bool>));
313 EXPECT_EQ (
true, (StrictTotallyOrdered<int>));
314 EXPECT_EQ (
true, (StrictTotallyOrdered<double>));
315 EXPECT_EQ (
false, (StrictTotallyOrdered<Empty>));
316 EXPECT_EQ (
false, (StrictTotallyOrdered<A>));
317 EXPECT_EQ (
true, (StrictTotallyOrdered<B>));
320 EXPECT_EQ (
false, (StrictTotallyOrderedWith<void, void>));
321 EXPECT_EQ (
false, (StrictTotallyOrderedWith<int, void>));
322 EXPECT_EQ (
true, (StrictTotallyOrderedWith<bool, bool>));
323 EXPECT_EQ (
true, (StrictTotallyOrderedWith<int, double>));
324 EXPECT_EQ (
false, (StrictTotallyOrderedWith<int, Empty>));
325 EXPECT_EQ (
false, (StrictTotallyOrderedWith<Base, Derived1>));
326 EXPECT_EQ (
false, (StrictTotallyOrderedWith<A, A>));
327 EXPECT_EQ (
true, (StrictTotallyOrderedWith<B, B>));
328 EXPECT_EQ (
false, (StrictTotallyOrderedWith<A, B>));
336 EXPECT_EQ (
false, (Semiregular<HaveOnlyMove>));
337 EXPECT_EQ (
false, (Semiregular<HaveOnlyCopy>));
338 EXPECT_EQ (
false, (Semiregular<HaveCopyAndMove>));
347 EXPECT_EQ (
false, (Regular<HaveOnlyMove>));
348 EXPECT_EQ (
false, (Regular<HaveOnlyCopy>));
349 EXPECT_EQ (
false, (Regular<HaveCopyAndMove>));
368 EXPECT_EQ (
false, (FloatingPoint<void>));
369 EXPECT_EQ (
true, (FloatingPoint<float>));
370 EXPECT_EQ (
true, (FloatingPoint<double>));
372 EXPECT_EQ (
false, (FloatingPoint<float*>));
378 void operator() (
int) { };
379 void operator() () { };
382 bool operator () (
int) {
return true; }
383 bool operator () (
int,
int) {
return true; }
388 EXPECT_EQ (
true, (Invocable<Inv, double>));
389 EXPECT_EQ (
false, (Invocable<Inv, Empty>));
391 EXPECT_EQ (
true, (RegularInvocable<Inv, int>));
393 EXPECT_EQ (
false, (Predicate<Inv, int>));
394 EXPECT_EQ (
true, (Predicate<Pred, int>));
395 EXPECT_EQ (
false, (Predicate<Pred, Empty>));
397 EXPECT_EQ (
true, (Relation<Pred, int, int>));
398 EXPECT_EQ (
true, (Relation<Pred, int, double>));
399 EXPECT_EQ (
false, (Relation<Pred, Empty, int>));
401 EXPECT_EQ (
true, (StrictWeakOrder<Pred, int, int>));
402 EXPECT_EQ (
false, (StrictWeakOrder<Pred, int, Empty>));
415 EXPECT_EQ (
true, (WeaklyIncrementable<int>));
416 EXPECT_EQ (
false, (WeaklyIncrementable<void>));
417 EXPECT_EQ (
false, (WeaklyIncrementable<meta::nil_>));
418 EXPECT_EQ (
true, (WeaklyIncrementable<Incr>));
419 EXPECT_EQ (
false, (WeaklyIncrementable<Incr&>));
bool operator<=(const B &l, const B &r)
_utlConcept ConvertibleTo
bool operator!=(const A &l, const A &r)
_utlConcept CommonReference
Concepts main include header.
STL's core language concepts.
bool operator<(const B &l, const B &r)
bool operator>(const B &l, const B &r)
_utlConcept UnsignedIntegral
#define EXPECT_EQ(val1, val2)
bool operator>=(const B &l, const B &r)
_utlConcept Constructible
HavePerfectForwarding(T &&)
_utlConcept SignedIntegral
bool operator==(const A &l, const A &r)