/usr/include/wibble/sfinae.h is in libwibble-dev 1.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | // -*- C++ -*- Substitution Failure Is Not An Error
#ifndef WIBBLE_SFINAE_H
#define WIBBLE_SFINAE_H
namespace wibble {
struct Unit {
bool operator<( Unit ) const { return false; }
bool operator==( Unit ) const { return true; }
};
struct TTrue {
static const bool value = true;
};
struct TFalse {
static const bool value = false;
};
// small SFINAE utilities, we probably prefer to avoid full weight of boost here
template< typename A, typename B >
struct TSame {
static const bool value = false;
};
template< typename A >
struct TSame< A, A > {
static const bool value = true;
};
template< bool, bool, bool = true, bool = true, bool = true >
struct TAndC {
static const bool value = false;
};
template<>
struct TAndC< true, true, true, true, true > {
static const bool value = true;
};
template< typename A, typename B,
typename C = TTrue, typename D = TTrue, typename E = TTrue >
struct TAnd : TAndC< A::value, B::value, C::value, D::value, E::value > {};
template< bool, bool, bool = false, bool = false, bool = false >
struct TOrC {
static const bool value = true;
};
template<>
struct TOrC< false, false, false, false, false > {
static const bool value = false;
};
template< typename A, typename B,
typename C = TFalse, typename D = TFalse, typename E = TFalse >
struct TOr : TOrC< A::value, B::value, C::value, D::value, E::value > {};
/* template< typename T >
struct IsT {
static const bool value = true;
}; */
template< bool a > struct TNotC {
static const bool value = !a;
};
template< typename T > struct TNot : TNotC< T::value > {};
template< bool a, bool b >
struct TImplyC : TNot< TAndC< a, TNotC< b >::value > > {};
template< typename A, typename B >
struct TImply : TImplyC< A::value, B::value > {};
template< bool, typename T = Unit >
struct EnableIfC {};
template< typename Type >
struct EnableIfC< true, Type > { typedef Type T; };
template< bool, typename T = Unit >
struct DisableIfC {};
template< typename Type >
struct DisableIfC< false, Type > { typedef Type T; };
template< typename X, typename T = Unit >
struct EnableIf : EnableIfC< X::value, T > {};
template< typename X, typename T = Unit >
struct DisableIf : DisableIfC< X::value, T > {};
template< typename A, typename B >
struct TPair {
typedef A First;
typedef B Second;
};
struct Preferred {};
struct NotPreferred { NotPreferred( Preferred ) {} };
}
#endif
|