]> git.tdb.fi Git - libs/core.git/blob - source/core/meta.h
Filter the types that get fallback lexical conversion operators
[libs/core.git] / source / core / meta.h
1 #ifndef MSP_CORE_META_H_
2 #define MSP_CORE_META_H_
3
4 namespace Msp {
5
6 template<typename T>
7 struct RemoveConst
8 { typedef T Type; };
9
10 template<typename T>
11 struct RemoveConst<const T>
12 { typedef T Type; };
13
14
15 template<typename T>
16 struct RemoveReference
17 { typedef T Type; };
18
19 template<typename T>
20 struct RemoveReference<T &>
21 { typedef T Type; };
22
23
24 template<bool c, typename R>
25 struct EnableIf;
26
27 template<typename R>
28 struct EnableIf<true, R>
29 { typedef R Yes; };
30
31 template<typename R>
32 struct EnableIf<false, R>
33 { typedef R No; };
34
35
36 /**
37 Common fragments used in SFINAE-based decider constructs.
38 */
39 struct Sfinae
40 {
41         struct Yes { char c[2]; };
42         struct No { char c; };
43
44         template<size_t s>
45         struct Evaluate
46         {
47                 enum { value = (s==sizeof(Yes)) };
48         };
49 };
50
51 } // namespace Msp
52
53 #endif