00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PALUDIS_GUARD_PALUDIS_UTIL_SR_HH
00021 #define PALUDIS_GUARD_PALUDIS_UTIL_SR_HH 1
00022
00023 #include <paludis/util/attributes.hh>
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 namespace paludis
00036 {
00037 template <bool value_, typename IfTrue_, typename IfFalse_>
00038 struct Select;
00039
00040
00041
00042
00043
00044
00045 template <typename IfTrue_, typename IfFalse_>
00046 struct Select<true, IfTrue_, IfFalse_>
00047 {
00048
00049 typedef IfTrue_ Type;
00050 };
00051
00052
00053
00054
00055
00056
00057 template <typename IfTrue_, typename IfFalse_>
00058 struct Select<false, IfTrue_, IfFalse_>
00059 {
00060
00061 typedef IfFalse_ Type;
00062 };
00063
00064 template <bool value_>
00065 struct SelectValue;
00066
00067
00068
00069
00070
00071
00072 template <>
00073 struct SelectValue<true>
00074 {
00075 template <typename IfTrue_, typename IfFalse_>
00076 static const IfTrue_ & get(const IfTrue_ & v, const IfFalse_ &)
00077 {
00078 return v;
00079 }
00080 };
00081
00082
00083
00084
00085
00086
00087 template <>
00088 struct SelectValue<false>
00089 {
00090 template <typename IfTrue_, typename IfFalse_>
00091 static const IfFalse_ & get(const IfTrue_ &, const IfFalse_ & v)
00092 {
00093 return v;
00094 }
00095 };
00096 }
00097
00098 #endif
00099