Go to the documentation of this file.00001
00010 #ifndef HELP_GET_HH
00011 #define HELP_GET_HH
00012
00013 #include"../type_list/type_list.hh"
00014 #include"../type_list/get_list.hh"
00015
00016 namespace my_lib{
00018 namespace internal{
00019
00025 template<typename TList, unsigned N>
00026 struct HelpGet {
00027 typedef typename type_list::GetType<TList,N>::type val_type;
00028 typedef typename TList::tail tail;
00029
00038 static val_type& get(Nuple<tail>& uple) {
00039 return HelpGet<tail,N-1>::get(uple) ;
00040 }
00041
00050 static const val_type& get(const Nuple<tail>& uple) {
00051 return HelpGet<tail,N-1>::get(uple) ;
00052 }
00053 };
00054
00056 template<typename TList>
00057 struct HelpGet<TList, 0> {
00058 typedef typename TList::head val_type;
00060 static val_type& get(Nuple<TList>& uple){
00061 return uple.val;
00062 }
00063
00064 static const val_type& get(const Nuple<TList>& uple){
00065 return uple.val;
00066 }
00067 };
00068
00075 template<typename TList, unsigned N>
00076 struct PrintNuple {
00077 static void print(std::ostream& o, const Nuple<TList>& u) {
00078 PrintNuple<TList, N-1>::print(o, u);
00079 o << internal::HelpGet<TList, N-1>::get(u) << ' ';
00080 }
00081 };
00082
00083 template<typename TList>
00084 struct PrintNuple<TList, 0> {
00085 static void print(std::ostream& o, const Nuple<TList>& u) {}
00086 };
00087
00088
00089 }
00090 }
00091
00092 #endif //HELP_GET_HH