@@ -33,11 +33,53 @@ template <class T> class rv;
33
33
34
34
namespace move_detail {
35
35
36
+ // ////////////////////////////////////
37
+ // is_different
38
+ // ////////////////////////////////////
39
+ template <class T , class U >
40
+ struct is_different
41
+ {
42
+ static const bool value = !is_same<T, U>::value;
43
+ };
44
+
45
+ // ////////////////////////////////////
46
+ // apply
47
+ // ////////////////////////////////////
48
+ template <class F , class Param >
49
+ struct apply
50
+ {
51
+ typedef typename F::template apply<Param>::type type;
52
+ };
53
+
54
+ // ////////////////////////////////////
55
+ // bool_
56
+ // ////////////////////////////////////
57
+
58
+ template < bool C_ >
59
+ struct bool_ : integral_constant<bool , C_>
60
+ {
61
+ operator bool () const { return C_; }
62
+ bool operator ()() const { return C_; }
63
+ };
64
+
65
+ typedef bool_<true > true_;
66
+ typedef bool_<false > false_;
67
+
36
68
// ////////////////////////////////////
37
69
// nat
38
70
// ////////////////////////////////////
39
71
struct nat {};
40
72
73
+ // ////////////////////////////////////
74
+ // yes_type/no_type
75
+ // ////////////////////////////////////
76
+ typedef char yes_type;
77
+
78
+ struct no_type
79
+ {
80
+ char _[2 ];
81
+ };
82
+
41
83
// ////////////////////////////////////
42
84
// natify
43
85
// ////////////////////////////////////
@@ -86,9 +128,27 @@ struct remove_reference< const rv<T> &>
86
128
typedef T type;
87
129
};
88
130
89
-
90
131
#endif
91
132
133
+ // ////////////////////////////////////
134
+ // remove_pointer
135
+ // ////////////////////////////////////
136
+
137
+ template < class T > struct remove_pointer { typedef T type; };
138
+ template < class T > struct remove_pointer <T*> { typedef T type; };
139
+ template < class T > struct remove_pointer <T* const > { typedef T type; };
140
+ template < class T > struct remove_pointer <T* volatile > { typedef T type; };
141
+ template < class T > struct remove_pointer <T* const volatile > { typedef T type; };
142
+
143
+ // ////////////////////////////////////
144
+ // add_pointer
145
+ // ////////////////////////////////////
146
+ template < class T >
147
+ struct add_pointer
148
+ {
149
+ typedef typename remove_reference<T>::type* type;
150
+ };
151
+
92
152
// ////////////////////////////////////
93
153
// add_const
94
154
// ////////////////////////////////////
@@ -151,6 +211,19 @@ struct is_lvalue_reference<T&>
151
211
static const bool value = true ;
152
212
};
153
213
214
+
215
+ // ////////////////////////////////////
216
+ // identity
217
+ // ////////////////////////////////////
218
+ template <class T >
219
+ struct identity
220
+ {
221
+ typedef T type;
222
+ typedef typename add_const_lvalue_reference<T>::type reference;
223
+ reference operator ()(reference t)
224
+ { return t; }
225
+ };
226
+
154
227
// ////////////////////////////////////
155
228
// is_class_or_union
156
229
// ////////////////////////////////////
@@ -241,9 +314,128 @@ class is_convertible
241
314
242
315
#endif
243
316
317
+ template <
318
+ bool C
319
+ , typename F1
320
+ , typename F2
321
+ >
322
+ struct eval_if_c
323
+ : if_c<C,F1,F2>::type
324
+ {};
325
+
326
+ template <
327
+ typename C
328
+ , typename T1
329
+ , typename T2
330
+ >
331
+ struct eval_if
332
+ : if_<C,T1,T2>::type
333
+ {};
334
+
335
+ template <class T , class U , class R = void >
336
+ struct enable_if_convertible
337
+ : enable_if< is_convertible<T, U>, R>
338
+ {};
339
+
340
+ template <class T , class U , class R = void >
341
+ struct disable_if_convertible
342
+ : disable_if< is_convertible<T, U>, R>
343
+ {};
344
+
345
+ // ////////////////////////////////////////////////////////////////////////////
346
+ //
347
+ // and_
348
+ //
349
+ // ////////////////////////////////////////////////////////////////////////////
350
+ template <bool Bool, class B = true_, class C = true_, class D = true_>
351
+ struct and_impl
352
+ : and_impl<B::value, C, D>
353
+ {};
354
+
355
+ template <>
356
+ struct and_impl <true , true_, true_, true_>
357
+ {
358
+ static const bool value = true ;
359
+ };
360
+
361
+ template <class B , class C , class D >
362
+ struct and_impl <false , B, C, D>
363
+ {
364
+ static const bool value = false ;
365
+ };
366
+
367
+ template <class A , class B , class C = true_, class D = true_>
368
+ struct and_
369
+ : and_impl<A::value, B, C, D>
370
+ {};
371
+
372
+ // ////////////////////////////////////////////////////////////////////////////
373
+ //
374
+ // or_
375
+ //
376
+ // ////////////////////////////////////////////////////////////////////////////
377
+ template <bool Bool, class B = false_, class C = false_, class D = false_>
378
+ struct or_impl
379
+ : or_impl<B::value, C, D>
380
+ {};
381
+
382
+ template <>
383
+ struct or_impl <false , false_, false_, false_>
384
+ {
385
+ static const bool value = false ;
386
+ };
387
+
388
+ template <class B , class C , class D >
389
+ struct or_impl <true , B, C, D>
390
+ {
391
+ static const bool value = true ;
392
+ };
393
+
394
+ template <class A , class B , class C = false_, class D = false_>
395
+ struct or_
396
+ : or_impl<A::value, B, C, D>
397
+ {};
398
+
399
+ // ////////////////////////////////////////////////////////////////////////////
400
+ //
401
+ // not_
402
+ //
403
+ // ////////////////////////////////////////////////////////////////////////////
404
+ template <class T >
405
+ struct not_
406
+ {
407
+ static const bool value = !T::value;
408
+ };
409
+
410
+ // ////////////////////////////////////////////////////////////////////////////
411
+ //
412
+ // enable_if_and / disable_if_and / enable_if_or / disable_if_or
413
+ //
414
+ // ////////////////////////////////////////////////////////////////////////////
415
+
416
+ template <class R , class A , class B , class C = true_, class D = true_>
417
+ struct enable_if_and
418
+ : enable_if_c< and_<A, B, C, D>::value, R>
419
+ {};
420
+
421
+ template <class R , class A , class B , class C = true_, class D = true_>
422
+ struct disable_if_and
423
+ : disable_if_c< and_<A, B, C, D>::value, R>
424
+ {};
425
+
426
+ template <class R , class A , class B , class C = false_, class D = false_>
427
+ struct enable_if_or
428
+ : enable_if_c< or_<A, B, C, D>::value, R>
429
+ {};
430
+
431
+ template <class R , class A , class B , class C = false_, class D = false_>
432
+ struct disable_if_or
433
+ : disable_if_c< or_<A, B, C, D>::value, R>
434
+ {};
435
+
244
436
// ////////////////////////////////////////////////////////////////////////////
245
437
//
246
- // has_move_emulation_enabled_impl
438
+ // has_move_emulation_enabled_impl
247
439
//
248
440
// ////////////////////////////////////////////////////////////////////////////
249
441
template <class T >
0 commit comments