00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef LEMON_UTILITY_H
00035 #define LEMON_UTILITY_H
00036
00037 namespace lemon
00038 {
00039
00041
00044 struct True {
00045 static const bool value = true;
00046 };
00047
00049 struct False {
00050 static const bool value = false;
00051 };
00052
00053 template <typename T>
00054 struct Wrap {
00055 const T &value;
00056 Wrap(const T &t) : value(t) {}
00057 };
00058
00059
00060
00061
00062
00063 template <bool B, class T = void>
00064 struct enable_if_c {
00065 typedef T type;
00066 };
00067
00068 template <class T>
00069 struct enable_if_c<false, T> {};
00070
00071 template <class Cond, class T = void>
00072 struct enable_if : public enable_if_c<Cond::value, T> {};
00073
00074 template <bool B, class T>
00075 struct lazy_enable_if_c {
00076 typedef typename T::type type;
00077 };
00078
00079 template <class T>
00080 struct lazy_enable_if_c<false, T> {};
00081
00082 template <class Cond, class T>
00083 struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
00084
00085
00086 template <bool B, class T = void>
00087 struct disable_if_c {
00088 typedef T type;
00089 };
00090
00091 template <class T>
00092 struct disable_if_c<true, T> {};
00093
00094 template <class Cond, class T = void>
00095 struct disable_if : public disable_if_c<Cond::value, T> {};
00096
00097 template <bool B, class T>
00098 struct lazy_disable_if_c {
00099 typedef typename T::type type;
00100 };
00101
00102 template <class T>
00103 struct lazy_disable_if_c<true, T> {};
00104
00105 template <class Cond, class T>
00106 struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
00107
00108 }
00109
00110 #endif