| 1 |
#ifndef INCLUDED_CONVERSION_H_ |
| 2 |
#define INCLUDED_CONVERSION_H_ |
| 3 |
|
| 4 |
//CONVERSION |
| 5 |
template <typename T, typename U> |
| 6 |
class LconvertibleToR |
| 7 |
{ |
| 8 |
struct Char2 |
| 9 |
{ |
| 10 |
char array[2]; |
| 11 |
}; |
| 12 |
static T const &makeT(); |
| 13 |
static char test(U const &); |
| 14 |
static Char2 test(...); |
| 15 |
|
| 16 |
public: |
| 17 |
LconvertibleToR(LconvertibleToR const &other) = delete; |
| 18 |
enum { yes = sizeof(test(makeT())) == sizeof(char) }; |
| 19 |
enum { sameType = 0 }; |
| 20 |
}; |
| 21 |
|
| 22 |
template <typename T> |
| 23 |
class LconvertibleToR<T, T> |
| 24 |
{ |
| 25 |
public: |
| 26 |
LconvertibleToR(LconvertibleToR const &other) = delete; |
| 27 |
enum { yes = 1 }; |
| 28 |
enum { sameType = 1 }; |
| 29 |
}; |
| 30 |
//= |
| 31 |
//LBASERDERIVED |
| 32 |
template <typename Base, typename Derived> |
| 33 |
struct LBaseRDerived |
| 34 |
{ |
| 35 |
LBaseRDerived(LBaseRDerived const &) = delete; |
| 36 |
enum { |
| 37 |
yes = |
| 38 |
LconvertibleToR<Derived const *, Base const *>::yes && |
| 39 |
not LconvertibleToR<Base const *, void const *>::sameType |
| 40 |
}; |
| 41 |
}; |
| 42 |
//= |
| 43 |
//LBASERTRUE |
| 44 |
template <typename Base, typename Derived> |
| 45 |
struct LBaseRtrulyDerived |
| 46 |
{ |
| 47 |
LBaseRtrulyDerived(LBaseRtrulyDerived const &) = delete; |
| 48 |
enum { |
| 49 |
yes = |
| 50 |
LBaseRDerived<Base, Derived>::yes && |
| 51 |
not LconvertibleToR<Base const *, Derived const *>::sameType |
| 52 |
}; |
| 53 |
}; |
| 54 |
//= |
| 55 |
#endif |