ivl 679
ivl/details/core/tool/tuple.hpp
00001 /* This file is part of the ivl C++ library <http://image.ntua.gr/ivl>.
00002    A C++ template library extending syntax towards mathematical notation.
00003 
00004    Copyright (C) 2012 Yannis Avrithis <iavr@image.ntua.gr>
00005    Copyright (C) 2012 Kimon Kontosis <kimonas@image.ntua.gr>
00006 
00007    ivl is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU Lesser General Public License 
00009    version 3 as published by the Free Software Foundation.
00010 
00011    Alternatively, you can redistribute it and/or modify it under the terms 
00012    of the GNU General Public License version 2 as published by the Free 
00013    Software Foundation.
00014 
00015    ivl is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00018    See the GNU General Public License for more details.
00019 
00020    You should have received a copy of the GNU General Public License 
00021    and a copy of the GNU Lesser General Public License along 
00022    with ivl. If not, see <http://www.gnu.org/licenses/>. */
00023 
00024 #ifndef IVL_CORE_DETAILS_TOOL_INTERNAL_HPP
00025 #define IVL_CORE_DETAILS_TOOL_INTERNAL_HPP
00026 
00027 namespace ivl {
00028 
00029 // namespace internal declares structures that are not to
00030 // be used from outside of ivl.
00031 namespace internal {
00032 
00033 /*
00034 // class similar to boost::tuple, used to return multiple arguments from funcs.
00035 // (up to 4)
00036 template<
00037 class T1 = types::codeword<>, class T2 = types::codeword<>,
00038 class T3 = types::codeword<>, class T4 = types::codeword<> >
00039 class tuple
00040 {
00041         typedef typename types::bare_type<T1>::type j1;
00042         typedef typename types::bare_type<T2>::type j2;
00043         typedef typename types::bare_type<T3>::type j3;
00044         typedef typename types::bare_type<T4>::type j4;
00045         typedef typename types::t_if<types::t_eq<T1, codeword<> >,
00046                 types::number<0>, typename types::t_if<types::t_eq<T2, codeword<> >,
00047                 types::number<1>, typename types::t_if<types::t_eq<T3, codeword<> >,
00048                 types::number<2>, typename types::t_if<types::t_eq<T4, codeword<> >,
00049                 types::number<3>, types::number<4> >::type>::type>::type>::type
00050                         size_value_type;
00051 
00052 public:
00053         enum { size = size_value_type::value };
00054         T1 t1;
00055         T2 t2;
00056         T3 t3;
00057         T4 t4;
00058         tuple(const j1& t1 = j1(), const j2& t2 = j2(),
00059                 const j3& t3 = j3(), const j4& t4 = j4())
00060                 : t1(t1), t2(t2), t3(t3), t4(t4) {}
00061 
00062         void get(j1& o1) { o1 = t1; }
00063         void get(j1& o1, j2& o2) { o1 = t1; o2 = t2; }
00064         void get(j1& o1, j2& o2, j3& o3) { o1 = t1; o2 = t2; o3 = t3; }
00065         void get(j1& o1, j2& o2, j3& o3, j4& o4)
00066         { o1 = t1; o2 = t2; o3 = t3; o4 = t4; }
00067 
00068 };
00069 
00070 template<
00071 class T1, class T2 = types::codeword<>,
00072 class T3 = types::codeword<>, class T4 = types::codeword<> >
00073 tuple<T1, T2, T3, T4> tpl(T1 t1, T2 t2 = T2(), T3 t3 = T3(), T4 t4 = T4())
00074 {
00075         return tuple<T1, T2, T3, T4>(t1, t2, t3, t4);
00076 }
00077 */
00078 
00079 
00080 // class similar to boost::tuple, used to return multiple arguments from funcs.
00081 // (up to 10)
00082 
00083 namespace internal_details {
00084 
00085 template<class T>
00086 struct tpl_ref_type
00087 {
00088         typedef const typename types::bare_type<T>::type& cref;
00089         typedef typename types::bare_type<T>::type& ref;
00090 };
00091 template<class T>
00092 struct tpl_ref_type<const T&>
00093 {
00094         typedef const T& cref;
00095         typedef T& ref;
00096 };
00097 template<class T>
00098 struct tpl_ref_type<T&>
00099 {
00100         typedef T& cref;
00101         typedef T& ref;
00102 };
00103 
00104 template<int N, class T>
00105 struct tpl_val { };
00106 
00107 template<class T>
00108 struct tpl_val<1, T>
00109 {
00110         typedef typename T::t1 type;
00111         typedef typename types::best_ref<type, T>::type ref;
00112         static ref value(T& tpl) { return tpl.v1; }
00113 };
00114 
00115 template<class T>
00116 struct tpl_val<2, T>
00117 {
00118         typedef typename T::t2 type;
00119         typedef typename types::best_ref<type, T>::type ref;
00120         static ref value(T& tpl) { return tpl.v2; }
00121 };
00122 
00123 template<class T>
00124 struct tpl_val<3, T>
00125 {
00126         typedef typename T::t3 type;
00127         typedef typename types::best_ref<type, T>::type ref;
00128         static ref value(T& tpl) { return tpl.v3; }
00129 };
00130 
00131 template<class T>
00132 struct tpl_val<4, T>
00133 {
00134         typedef typename T::t4 type;
00135         typedef typename types::best_ref<type, T>::type ref;
00136         static ref value(T& tpl) { return tpl.v4; }
00137 };
00138 
00139 template<class T>
00140 struct tpl_val<5, T>
00141 {
00142         typedef typename T::t5 type;
00143         typedef typename types::best_ref<type, T>::type ref;
00144         static ref value(T& tpl) { return tpl.v5; }
00145 };
00146 
00147 template<class T>
00148 struct tpl_val<6, T>
00149 {
00150         typedef typename T::t6 type;
00151         typedef typename types::best_ref<type, T>::type ref;
00152         static ref value(T& tpl) { return tpl.v6; }
00153 };
00154 
00155 template<class T>
00156 struct tpl_val<7, T>
00157 {
00158         typedef typename T::t7 type;
00159         typedef typename types::best_ref<type, T>::type ref;
00160         static ref value(T& tpl) { return tpl.v7; }
00161 };
00162 
00163 template<class T>
00164 struct tpl_val<8, T>
00165 {
00166         typedef typename T::t8 type;
00167         typedef typename types::best_ref<type, T>::type ref;
00168         static ref value(T& tpl) { return tpl.v8; }
00169 };
00170 
00171 template<class T>
00172 struct tpl_val<9, T>
00173 {
00174         typedef typename T::t9 type;
00175         typedef typename types::best_ref<type, T>::type ref;
00176         static ref value(T& tpl) { return tpl.v9; }
00177 };
00178 
00179 template<class T>
00180 struct tpl_val<10, T>
00181 {
00182         typedef typename T::t10 type;
00183         typedef typename types::best_ref<type, T>::type ref;
00184         static ref value(T& tpl) { return tpl.v10; }
00185 };
00186 
00187 
00188 } /* namespace internal_details */
00189 
00190 template <class DERIVED>
00191 struct tuple_rvalue
00192 {
00193         typedef DERIVED derived_type;
00194         derived_type& derived() { return static_cast<derived_type&>(*this); }
00195         const derived_type& derived() const
00196                 { return static_cast<const derived_type&>(*this); }
00197         template<class TPL>
00198         void tuple_output(TPL& t) const { this->derived().tuple_output(t); }
00199         template<class TPL>
00200         void tuple_output(TPL& t) { this->derived().tuple_output(t); }
00201 };
00202 
00203 template <int N, class TPL>
00204 struct tuple_base
00205 {
00206         typedef TPL derived_type;
00207         derived_type& derived() { return static_cast<TPL&>(*this); }
00208         const derived_type& derived() const
00209                 { return static_cast<const TPL&>(*this); }
00210 };
00211 /*
00212 inline
00213 std::ostream& operator << (std::ostream& os, const types::skip&)
00214 {
00215         return os;
00216 }*/
00217 
00218 template<int N, class T>
00219 std::ostream& operator << (std::ostream& os, const tuple_base<N, T>& t)
00220 {
00221         os << "(";
00222         typedef types::t_ge<types::number<N>, types::number<1> > print1;
00223         os << types::r_if<print1>(t.derived().val(types::number<1>()), "");
00224         if(N > 1) os << ", ";
00225         typedef types::t_ge<types::number<N>, types::number<2> > print2;
00226         os << types::r_if<print2>(t.derived().val(types::number<2>()), "");
00227         if(N > 2) os << ", ";
00228         typedef types::t_ge<types::number<N>, types::number<3> > print3;
00229         os << types::r_if<print3>(t.derived().val(types::number<3>()), "");
00230         if(N > 3) os << ", ";
00231         typedef types::t_ge<types::number<N>, types::number<4> > print4;
00232         os << types::r_if<print4>(t.derived().val(types::number<4>()), "");
00233         if(N > 4) os << ", ";
00234         typedef types::t_ge<types::number<N>, types::number<5> > print5;
00235         os << types::r_if<print5>(t.derived().val(types::number<5>()), "");
00236         if(N > 5) os << ", ";
00237         typedef types::t_ge<types::number<N>, types::number<6> > print6;
00238         os << types::r_if<print6>(t.derived().val(types::number<6>()), "");
00239         if(N > 6) os << ", ";
00240         typedef types::t_ge<types::number<N>, types::number<7> > print7;
00241         os << types::r_if<print7>(t.derived().val(types::number<7>()), "");
00242         if(N > 7) os << ", ";
00243         typedef types::t_ge<types::number<N>, types::number<8> > print8;
00244         os << types::r_if<print8>(t.derived().val(types::number<8>()), "");
00245         if(N > 8) os << ", ";
00246         typedef types::t_ge<types::number<N>, types::number<9> > print9;
00247         os << types::r_if<print9>(t.derived().val(types::number<9>()), "");
00248         if(N > 9) os << ", ";
00249         typedef types::t_ge<types::number<N>, types::number<10> > print10;
00250         os << types::r_if<print10>(t.derived().val(types::number<10>()), "");
00251         os << ")";
00252         return os;
00253 }
00254 
00255 template <class T1, class T2>
00256 class join_tuple : public tuple_base<T1::size + T2::size, join_tuple<T1, T2> >
00257 {
00258 public:
00259         template<int N>
00260         struct val_t
00261         {
00262                 typedef typename types::t_sub<
00263                         types::number<N>, typename T1::size_value_type>::type secondidx;
00264                 typedef typename types::t_le<
00265                         types::number<N>, typename T1::size_value_type>::type first;
00266 
00267                 typedef typename types::t_if<first,
00268                         typename internal_details::tpl_val<N, T1>,
00269                         typename internal_details::tpl_val<secondidx::value, T2>
00270                 >::type val_struct;
00271 
00272                 typedef typename val_struct::type type;
00273 
00274                 typedef typename val_struct::ref ref;
00275 
00276                 template <class T>
00277                 static ref val(T& t)
00278                 {
00279                         return val_struct::value(types::r_if<first>(t.t1, t.t2));
00280                 }
00281         };
00282 
00283         T1& t1;
00284         T2& t2;
00285         join_tuple(T1& t1, T2& t2) : t1(t1), t2(t2) { }
00286 
00287         typedef typename types::t_add<
00288                 typename T1::size_value_type, typename T2::size_value_type>
00289                 ::type size_value_type;
00290 
00291         enum { size = size_value_type::value };
00292 
00293         template<int N>
00294         typename val_t<N>::ref val(types::number<N>) const
00295         {
00296                 return val_t<N>::val(*this);
00297         }
00298 };
00299 
00300 template<
00301 class T1 = types::skip, class T2 = types::skip,
00302 class T3 = types::skip, class T4 = types::skip,
00303 class T5 = types::skip, class T6 = types::skip,
00304 class T7 = types::skip, class T8 = types::skip,
00305 class T9 = types::skip, class T10 = types::skip >
00306 class tuple
00307 :
00308 public tuple_base<types::t_if<types::t_eq<T1, types::skip>,
00309                 types::number<0>, typename types::t_if<types::t_eq<T2, types::skip>,
00310                 types::number<1>, typename types::t_if<types::t_eq<T3, types::skip>,
00311                 types::number<2>, typename types::t_if<types::t_eq<T4, types::skip>,
00312                 types::number<3>, typename types::t_if<types::t_eq<T5, types::skip>,
00313                 types::number<4>, typename types::t_if<types::t_eq<T6, types::skip>,
00314                 types::number<5>, typename types::t_if<types::t_eq<T7, types::skip>,
00315                 types::number<6>, typename types::t_if<types::t_eq<T8, types::skip>,
00316                 types::number<7>, typename types::t_if<types::t_eq<T9, types::skip>,
00317                 types::number<8>, typename types::t_if<types::t_eq<T10, types::skip>,
00318                 types::number<9>, types::number<10> >
00319                 ::type>::type>
00320                 ::type>::type>
00321                 ::type>::type>
00322                 ::type>::type>
00323                 ::type>::type::value,
00324         tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
00325 {
00326         typedef typename types::bare_type<T1>::type b1;
00327         typedef typename types::bare_type<T2>::type b2;
00328         typedef typename types::bare_type<T3>::type b3;
00329         typedef typename types::bare_type<T4>::type b4;
00330         typedef typename types::bare_type<T5>::type b5;
00331         typedef typename types::bare_type<T6>::type b6;
00332         typedef typename types::bare_type<T7>::type b7;
00333         typedef typename types::bare_type<T8>::type b8;
00334         typedef typename types::bare_type<T9>::type b9;
00335         typedef typename types::bare_type<T10>::type b10;
00336 
00337         typedef typename internal_details::tpl_ref_type<T1>::cref j1;
00338         typedef typename internal_details::tpl_ref_type<T2>::cref j2;
00339         typedef typename internal_details::tpl_ref_type<T3>::cref j3;
00340         typedef typename internal_details::tpl_ref_type<T4>::cref j4;
00341         typedef typename internal_details::tpl_ref_type<T5>::cref j5;
00342         typedef typename internal_details::tpl_ref_type<T6>::cref j6;
00343         typedef typename internal_details::tpl_ref_type<T7>::cref j7;
00344         typedef typename internal_details::tpl_ref_type<T8>::cref j8;
00345         typedef typename internal_details::tpl_ref_type<T9>::cref j9;
00346         typedef typename internal_details::tpl_ref_type<T10>::cref j10;
00347 
00348 public:
00349         typedef T1 t1;
00350         typedef T2 t2;
00351         typedef T3 t3;
00352         typedef T4 t4;
00353         typedef T5 t5;
00354         typedef T6 t6;
00355         typedef T7 t7;
00356         typedef T8 t8;
00357         typedef T9 t9;
00358         typedef T10 t10;
00359 
00360         typedef typename types::t_if<types::t_eq<T1, types::skip>,
00361                 types::number<0>, typename types::t_if<types::t_eq<T2, types::skip>,
00362                 types::number<1>, typename types::t_if<types::t_eq<T3, types::skip>,
00363                 types::number<2>, typename types::t_if<types::t_eq<T4, types::skip>,
00364                 types::number<3>, typename types::t_if<types::t_eq<T5, types::skip>,
00365                 types::number<4>, typename types::t_if<types::t_eq<T6, types::skip>,
00366                 types::number<5>, typename types::t_if<types::t_eq<T7, types::skip>,
00367                 types::number<6>, typename types::t_if<types::t_eq<T8, types::skip>,
00368                 types::number<7>, typename types::t_if<types::t_eq<T9, types::skip>,
00369                 types::number<8>, typename types::t_if<types::t_eq<T10, types::skip>,
00370                 types::number<9>, types::number<10> >
00371                 ::type>::type>
00372                 ::type>::type>
00373                 ::type>::type>
00374                 ::type>::type>
00375                 ::type>::type
00376                         size_value_type;
00377 
00378         enum { size = size_value_type::value };
00379 
00380         T1 v1;
00381         T2 v2;
00382         T3 v3;
00383         T4 v4;
00384         T5 v5;
00385         T6 v6;
00386         T7 v7;
00387         T8 v8;
00388         T9 v9;
00389         T10 v10;
00390 
00391         tuple(j1 v1 = b1(), j2 v2 = b2(),
00392                 j3 v3 = b3(), j4 v4 = b4(),
00393                 j5 v5 = b5(), j6 v6 = b6(),
00394                 j7 v7 = b7(), j8 v8 = b8(),
00395                 j9 v9 = b9(), j10 v10 = b10())
00396                 : v1(v1), v2(v2), v3(v3), v4(v4),
00397                         v5(v5), v6(v6), v7(v7), v8(v8),
00398                         v9(v9), v10(v10) {}
00399 
00400         template<int N, class TPL>
00401         tuple(const tuple_base<N, TPL>& t) :
00402                 v1(t.derived().val(types::number<1>())),
00403                 v2(t.derived().val(types::number<2>())),
00404                 v3(t.derived().val(types::number<3>())),
00405                 v4(t.derived().val(types::number<4>())),
00406                 v5(t.derived().val(types::number<5>())),
00407                 v6(t.derived().val(types::number<6>())),
00408                 v7(t.derived().val(types::number<7>())),
00409                 v8(t.derived().val(types::number<8>())),
00410                 v9(t.derived().val(types::number<9>())),
00411                 v10(t.derived().val(types::number<10>())) {}
00412 
00413         tuple& operator=(const tuple& o)
00414         {
00415                 types::r_if<types::is_const<T1> >(types::skip(), v1) = o.v1;
00416                 types::r_if<types::is_const<T2> >(types::skip(), v2) = o.v2;
00417                 types::r_if<types::is_const<T3> >(types::skip(), v3) = o.v3;
00418                 types::r_if<types::is_const<T4> >(types::skip(), v4) = o.v4;
00419                 types::r_if<types::is_const<T5> >(types::skip(), v5) = o.v5;
00420                 types::r_if<types::is_const<T6> >(types::skip(), v6) = o.v6;
00421                 types::r_if<types::is_const<T7> >(types::skip(), v7) = o.v7;
00422                 types::r_if<types::is_const<T8> >(types::skip(), v8) = o.v8;
00423                 types::r_if<types::is_const<T9> >(types::skip(), v9) = o.v9;
00424                 types::r_if<types::is_const<T10> >(types::skip(), v10) = o.v10;
00425                 return *this;
00426         }
00427 
00428         template<class TPL>
00429         tuple& operator=(const tuple_base<size, TPL>& o)
00430         {
00431                 v1 = o.derived().v1;
00432                 v2 = o.derived().v2;
00433                 v3 = o.derived().v3;
00434                 v4 = o.derived().v4;
00435                 v5 = o.derived().v5;
00436                 v6 = o.derived().v6;
00437                 v7 = o.derived().v7;
00438                 v8 = o.derived().v8;
00439                 v9 = o.derived().v9;
00440                 v10 = o.derived().v10;
00441                 return *this;
00442         }
00443 
00444         template<class F>
00445         tuple& operator=(const tuple_rvalue<F>& v)
00446         {
00447                 v.tuple_output(*this);
00448                 return *this;
00449         }
00450 
00451         template<class F>
00452         tuple& operator=(tuple_rvalue<F>& v)
00453         {
00454                 v.tuple_output(*this);
00455                 return *this;
00456         }
00457 
00458         template<class TPL>
00459         struct concat_t
00460         {
00461                 typedef join_tuple<const tuple, TPL> join_class;
00462                 typedef tuple<
00463                 typename join_class::template val_t<1>::type,
00464                 typename join_class::template val_t<2>::type,
00465                 typename join_class::template val_t<3>::type,
00466                 typename join_class::template val_t<4>::type,
00467                 typename join_class::template val_t<5>::type,
00468                 typename join_class::template val_t<6>::type,
00469                 typename join_class::template val_t<7>::type,
00470                 typename join_class::template val_t<8>::type,
00471                 typename join_class::template val_t<9>::type,
00472                 typename join_class::template val_t<10>::type> type;
00473         };
00474 
00475         template<class EL>
00476         struct append_t
00477         {
00478                 typedef join_tuple<const tuple, const tuple<EL> > join_class;
00479                 typedef tuple<
00480                 typename join_class::template val_t<1>::type,
00481                 typename join_class::template val_t<2>::type,
00482                 typename join_class::template val_t<3>::type,
00483                 typename join_class::template val_t<4>::type,
00484                 typename join_class::template val_t<5>::type,
00485                 typename join_class::template val_t<6>::type,
00486                 typename join_class::template val_t<7>::type,
00487                 typename join_class::template val_t<8>::type,
00488                 typename join_class::template val_t<9>::type,
00489                 typename join_class::template val_t<10>::type> type;
00490         };
00491 
00492         // operator, for tuple concatenation
00493         template<class EL>
00494         typename tuple::template append_t<const EL&>
00495                 ::type operator,(const EL& e) const
00496         {
00497                 return typename append_t<const EL&>
00498                         ::join_class(*this, tuple<const EL&>(e));
00499         }
00500 
00501         template<class EL>
00502         typename tuple::template append_t<EL&>
00503                 ::type operator,(EL& e) const
00504         {
00505                 return typename append_t<EL&>
00506                         ::join_class(*this, tuple<EL&>(e));
00507         }
00508 
00509         void get(b1& o1) { o1 = v1; }
00510         void get(b1& o1, b2& o2) { o1 = v1; o2 = v2; }
00511         void get(b1& o1, b2& o2, b3& o3) { o1 = v1; o2 = v2; o3 = v3; }
00512         void get(b1& o1, b2& o2, b3& o3, b4& o4)
00513                 { o1 = v1; o2 = v2; o3 = v3; o4 = v4; }
00514         void get(b1& o1, b2& o2, b3& o3, b4& o4, b5& o5)
00515                 { o1 = v1; o2 = v2; o3 = v3; o4 = v4; o5 = v5; }
00516         void get(b1& o1, b2& o2, b3& o3, b4& o4, b5& o5, b6& o6)
00517                 { o1 = v1; o2 = v2; o3 = v3; o4 = v4; o5 = v5; o6 = v6; }
00518         void get(b1& o1, b2& o2, b3& o3, b4& o4, b5& o5, b6& o6, b7& o7)
00519                 { o1 = v1; o2 = v2; o3 = v3; o4 = v4; o5 = v5; o6 = v6; o7 = v7; }
00520         void get(b1& o1, b2& o2, b3& o3, b4& o4, b5& o5, b6& o6, b7& o7,
00521                                 b8& o8)
00522         {
00523                         o1 = v1; o2 = v2; o3 = v3; o4 = v4; o5 = v5; o6 = v6; o7 = v7;
00524                         o8 = v8;
00525         }
00526         void get(b1& o1, b2& o2, b3& o3, b4& o4, b5& o5, b6& o6, b7& o7,
00527                                 b8& o8, b9& o9)
00528         {
00529                         o1 = v1; o2 = v2; o3 = v3; o4 = v4; o5 = v5; o6 = v6; o7 = v7;
00530                         o8 = v8; o9 = v9;
00531         }
00532         void get(b1& o1, b2& o2, b3& o3, b4& o4, b5& o5, b6& o6, b7& o7,
00533                                 b8& o8, b9& o9, b10& o10)
00534         {
00535                         o1 = v1; o2 = v2; o3 = v3; o4 = v4; o5 = v5; o6 = v6; o7 = v7;
00536                         o8 = v8; o9 = v9; o10 = v10;
00537         }
00538 
00539         template<int N>
00540         typename internal_details::tpl_val<N, tuple>::ref
00541                 val(types::number<N> = types::number<N>())
00542         {
00543                 return internal_details::tpl_val<N, tuple>::value(*this);
00544         }
00545         template<int N>
00546         typename internal_details::tpl_val<N, const tuple>::ref
00547                 val(types::number<N> = types::number<N>()) const
00548         {
00549                 return internal_details::tpl_val<N, const tuple>::value(*this);
00550         }
00551 
00552         template<int N>
00553         struct val_t : public internal_details::tpl_val<N, tuple> {};
00554 };
00555 
00556 namespace internal_details {
00557 
00558 struct sep_val
00559 {
00560         typedef ivl::sep type;
00561         typedef ivl::sep ref;
00562         template<class T>
00563         static inline ivl::sep value(T) { return ivl::sep(); }
00564 };
00565 
00566 } /* namespace internal_details */
00567 
00568 template <class T1, class T2>
00569 class join_tuple_sep
00570 : public tuple_base<T1::size + T2::size + 1, join_tuple_sep<T1, T2> >
00571 {
00572         template<int N>
00573         struct accessor
00574         {
00575                 typedef typename types::t_sub<
00576                         types::number<N - 1>, typename T1::size_value_type>::type secondidx;
00577                 typedef typename types::t_le<
00578                         types::number<N>, typename T1::size_value_type>::type first;
00579                 typedef typename types::t_eq<
00580                         types::number<N - 1>, typename T1::size_value_type>::type sp;
00581 
00582                 typedef typename types::t_if<first,
00583                         internal_details::tpl_val<N, T1>,
00584                         typename types::t_if<sp, internal_details::sep_val,
00585                                 internal_details::tpl_val<secondidx::value, T2>
00586                                 >::type
00587                 >::type val_struct;
00588 
00589                 typedef typename val_struct::type type;
00590 
00591                 /*typedef typename types::t_if<types::t_eq<
00592                         typename val_struct::type, ivl::sep>, ivl::sep,
00593                                 typename val_struct::ref>::type ref;*/
00594                 typedef typename val_struct::ref ref;
00595 
00596                 template <class T>
00597                 static ref val(T& t)
00598                 {
00599                         return val_struct::value(types::r_if<first>(t.t1, t.t2));
00600                 }
00601         };
00602 
00603 public:
00604         T1& t1;
00605         T2& t2;
00606         join_tuple_sep(T1& t1, T2& t2) : t1(t1), t2(t2) { }
00607 
00608         typedef typename types::t_add_3<types::number<1>,
00609                 typename T1::size_value_type, typename T2::size_value_type>
00610                 ::type size_value_type;
00611 
00612         enum { size = size_value_type::value };
00613 
00614         template<int N>
00615         typename accessor<N>::ref val(types::number<N>) const
00616         {
00617                 return accessor<N>::val(*this);
00618         }
00619 };
00620 
00621 template<class T1, class T2>
00622 join_tuple_sep<const T1, const T2> tplsjoin(const T1& t1, const T2& t2)
00623 {
00624         return join_tuple_sep<const T1, const T2>(t1, t2);
00625 }
00626 // ----------------------------------------------------------------------------
00627 
00628 namespace internal_details {
00629 
00630 template<class T>
00631 struct ref_t
00632 {
00633         T& r;
00634         operator T&() { return r; }
00635         ref_t(T& r) : r(r) { }
00636 };
00637 
00638 template<class T>
00639 struct reslv
00640 {
00641         typedef T type;
00642 };
00643 
00644 template<class T>
00645 struct reslv<ref_t<T> >
00646 {
00647         typedef T& type;
00648 };
00649 
00650 } /* namespace internal_details */
00651 
00652 // ----------------------------------------------------------------------------
00653 
00654 template<class T>
00655 internal_details::ref_t<T> ref(T& r)
00656 {
00657         return r;
00658 }
00659 
00660 // ----------------------------------------------------------------------------
00661 
00662 
00663 template<class T1>
00664 tuple<
00665                 typename internal_details::reslv<T1>::type
00666         > tpl(T1 t1)
00667 {
00668         return tuple<
00669                 typename internal_details::reslv<T1>::type
00670         >(t1);
00671 }
00672 
00673 template<class T1, class T2>
00674 tuple<
00675                 typename internal_details::reslv<T1>::type,
00676                 typename internal_details::reslv<T2>::type
00677         > tpl(T1 t1, T2 t2)
00678 {
00679         return tuple<
00680                 typename internal_details::reslv<T1>::type,
00681                 typename internal_details::reslv<T2>::type
00682         >(t1, t2);
00683 }
00684 
00685 template<class T1, class T2, class T3>
00686 tuple<
00687                 typename internal_details::reslv<T1>::type,
00688                 typename internal_details::reslv<T2>::type,
00689                 typename internal_details::reslv<T3>::type
00690         > tpl(T1 t1, T2 t2, T3 t3)
00691 {
00692         return tuple<
00693                 typename internal_details::reslv<T1>::type,
00694                 typename internal_details::reslv<T2>::type,
00695                 typename internal_details::reslv<T3>::type
00696         >(t1, t2, t3);
00697 }
00698 
00699 template<class T1, class T2, class T3, class T4>
00700 tuple<
00701                 typename internal_details::reslv<T1>::type,
00702                 typename internal_details::reslv<T2>::type,
00703                 typename internal_details::reslv<T3>::type,
00704                 typename internal_details::reslv<T4>::type
00705         > tpl(T1 t1, T2 t2, T3 t3, T4 t4)
00706 {
00707         return tuple<
00708                 typename internal_details::reslv<T1>::type,
00709                 typename internal_details::reslv<T2>::type,
00710                 typename internal_details::reslv<T3>::type,
00711                 typename internal_details::reslv<T4>::type
00712         >(t1, t2, t3, t4);
00713 }
00714 
00715 template<class T1, class T2, class T3, class T4, class T5>
00716 tuple<
00717                 typename internal_details::reslv<T1>::type,
00718                 typename internal_details::reslv<T2>::type,
00719                 typename internal_details::reslv<T3>::type,
00720                 typename internal_details::reslv<T4>::type,
00721                 typename internal_details::reslv<T5>::type
00722         > tpl(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
00723 {
00724         return tuple<
00725                 typename internal_details::reslv<T1>::type,
00726                 typename internal_details::reslv<T2>::type,
00727                 typename internal_details::reslv<T3>::type,
00728                 typename internal_details::reslv<T4>::type,
00729                 typename internal_details::reslv<T5>::type
00730         >(t1, t2, t3, t4, t5);
00731 }
00732 
00733 template<class T1, class T2, class T3, class T4, class T5, class T6>
00734 tuple<
00735                 typename internal_details::reslv<T1>::type,
00736                 typename internal_details::reslv<T2>::type,
00737                 typename internal_details::reslv<T3>::type,
00738                 typename internal_details::reslv<T4>::type,
00739                 typename internal_details::reslv<T5>::type,
00740                 typename internal_details::reslv<T6>::type
00741         > tpl(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
00742 {
00743         return tuple<
00744                 typename internal_details::reslv<T1>::type,
00745                 typename internal_details::reslv<T2>::type,
00746                 typename internal_details::reslv<T3>::type,
00747                 typename internal_details::reslv<T4>::type,
00748                 typename internal_details::reslv<T5>::type,
00749                 typename internal_details::reslv<T6>::type
00750         >(t1, t2, t3, t4, t5, t6);
00751 }
00752 
00753 template<class T1, class T2, class T3, class T4, class T5, class T6, class T7>
00754 tuple<
00755                 typename internal_details::reslv<T1>::type,
00756                 typename internal_details::reslv<T2>::type,
00757                 typename internal_details::reslv<T3>::type,
00758                 typename internal_details::reslv<T4>::type,
00759                 typename internal_details::reslv<T5>::type,
00760                 typename internal_details::reslv<T6>::type,
00761                 typename internal_details::reslv<T7>::type
00762         > tpl(T1 t1,
00763         T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
00764 {
00765         return tuple<
00766                 typename internal_details::reslv<T1>::type,
00767                 typename internal_details::reslv<T2>::type,
00768                 typename internal_details::reslv<T3>::type,
00769                 typename internal_details::reslv<T4>::type,
00770                 typename internal_details::reslv<T5>::type,
00771                 typename internal_details::reslv<T6>::type,
00772                 typename internal_details::reslv<T7>::type
00773         >(t1, t2, t3, t4, t5, t6, t7);
00774 }
00775 
00776 template
00777 <class T1, class T2, class T3, class T4, class T5,
00778  class T6, class T7, class T8>
00779 tuple<
00780                 typename internal_details::reslv<T1>::type,
00781                 typename internal_details::reslv<T2>::type,
00782                 typename internal_details::reslv<T3>::type,
00783                 typename internal_details::reslv<T4>::type,
00784                 typename internal_details::reslv<T5>::type,
00785                 typename internal_details::reslv<T6>::type,
00786                 typename internal_details::reslv<T7>::type,
00787                 typename internal_details::reslv<T8>::type
00788         > tpl(T1 t1,
00789         T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
00790 {
00791         return tuple<
00792                 typename internal_details::reslv<T1>::type,
00793                 typename internal_details::reslv<T2>::type,
00794                 typename internal_details::reslv<T3>::type,
00795                 typename internal_details::reslv<T4>::type,
00796                 typename internal_details::reslv<T5>::type,
00797                 typename internal_details::reslv<T6>::type,
00798                 typename internal_details::reslv<T7>::type,
00799                 typename internal_details::reslv<T8>::type
00800         >(
00801                 t1, t2, t3, t4, t5, t6, t7, t8);
00802 }
00803 
00804 template
00805 <class T1, class T2, class T3, class T4, class T5,
00806  class T6, class T7, class T8, class T9>
00807 tuple<
00808                 typename internal_details::reslv<T1>::type,
00809                 typename internal_details::reslv<T2>::type,
00810                 typename internal_details::reslv<T3>::type,
00811                 typename internal_details::reslv<T4>::type,
00812                 typename internal_details::reslv<T5>::type,
00813                 typename internal_details::reslv<T6>::type,
00814                 typename internal_details::reslv<T7>::type,
00815                 typename internal_details::reslv<T8>::type,
00816                 typename internal_details::reslv<T9>::type
00817         > tpl(T1 t1,
00818         T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9)
00819 {
00820         return tuple<
00821                 typename internal_details::reslv<T1>::type,
00822                 typename internal_details::reslv<T2>::type,
00823                 typename internal_details::reslv<T3>::type,
00824                 typename internal_details::reslv<T4>::type,
00825                 typename internal_details::reslv<T5>::type,
00826                 typename internal_details::reslv<T6>::type,
00827                 typename internal_details::reslv<T7>::type,
00828                 typename internal_details::reslv<T8>::type,
00829                 typename internal_details::reslv<T9>::type
00830         >(
00831                 t1, t2, t3, t4, t5, t6, t7, t8, t9);
00832 }
00833 
00834 template
00835 <class T1, class T2, class T3, class T4, class T5,
00836  class T6, class T7, class T8, class T9, class T10>
00837 tuple<
00838                 typename internal_details::reslv<T1>::type,
00839                 typename internal_details::reslv<T2>::type,
00840                 typename internal_details::reslv<T3>::type,
00841                 typename internal_details::reslv<T4>::type,
00842                 typename internal_details::reslv<T5>::type,
00843                 typename internal_details::reslv<T6>::type,
00844                 typename internal_details::reslv<T7>::type,
00845                 typename internal_details::reslv<T8>::type,
00846                 typename internal_details::reslv<T9>::type,
00847                 typename internal_details::reslv<T10>::type
00848         > tpl(T1 t1,
00849         T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10)
00850 {
00851         return tuple<
00852                 typename internal_details::reslv<T1>::type,
00853                 typename internal_details::reslv<T2>::type,
00854                 typename internal_details::reslv<T3>::type,
00855                 typename internal_details::reslv<T4>::type,
00856                 typename internal_details::reslv<T5>::type,
00857                 typename internal_details::reslv<T6>::type,
00858                 typename internal_details::reslv<T7>::type,
00859                 typename internal_details::reslv<T8>::type,
00860                 typename internal_details::reslv<T9>::type,
00861                 typename internal_details::reslv<T10>::type
00862         >(
00863                 t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
00864 }
00865 
00866 #if 0
00867 template<class T1>
00868 tuple<T1>  tpl(T1 t1)
00869 {
00870         return tuple<T1>(t1);
00871 }
00872 
00873 template<class T1, class T2>
00874 tuple<T1, T2>  tpl(T1 t1, T2 t2)
00875 {
00876         return tuple<T1, T2>(t1, t2);
00877 }
00878 
00879 template<class T1, class T2, class T3>
00880 tuple<T1, T2, T3>  tpl(T1 t1, T2 t2, T3 t3)
00881 {
00882         return tuple<T1, T2, T3>(t1, t2, t3);
00883 }
00884 
00885 template<class T1, class T2, class T3, class T4>
00886 tuple<T1, T2, T3, T4>  tpl(T1 t1, T2 t2, T3 t3, T4 t4)
00887 {
00888         return tuple<T1, T2, T3, T4>(t1, t2, t3, t4);
00889 }
00890 
00891 template<class T1, class T2, class T3, class T4, class T5>
00892 tuple<T1, T2, T3, T4, T5>  tpl(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
00893 {
00894         return tuple<T1, T2, T3, T4, T5>(t1, t2, t3, t4, t5);
00895 }
00896 
00897 template<class T1, class T2, class T3, class T4, class T5, class T6>
00898 tuple<T1, T2, T3, T4, T5, T6>  tpl(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
00899 {
00900         return tuple<T1, T2, T3, T4, T5, T6>(t1, t2, t3, t4, t5, t6);
00901 }
00902 
00903 template<class T1, class T2, class T3, class T4, class T5, class T6, class T7>
00904 tuple<T1, T2, T3, T4, T5, T6, T7>  tpl(T1 t1,
00905         T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
00906 {
00907         return tuple<T1, T2, T3, T4, T5, T6, T7>(t1, t2, t3, t4, t5, t6, t7);
00908 }
00909 
00910 template
00911 <class T1, class T2, class T3, class T4, class T5,
00912  class T6, class T7, class T8>
00913 tuple<T1, T2, T3, T4, T5, T6, T7, T8>  tpl(T1 t1,
00914         T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
00915 {
00916         return tuple<T1, T2, T3, T4, T5, T6, T7, T8>(
00917                 t1, t2, t3, t4, t5, t6, t7, t8);
00918 }
00919 
00920 template
00921 <class T1, class T2, class T3, class T4, class T5,
00922  class T6, class T7, class T8, class T9>
00923 tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>  tpl(T1 t1,
00924         T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9)
00925 {
00926         return tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
00927                 t1, t2, t3, t4, t5, t6, t7, t8, t9);
00928 }
00929 
00930 template
00931 <class T1, class T2, class T3, class T4, class T5,
00932  class T6, class T7, class T8, class T9, class T10>
00933 tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>  tpl(T1 t1,
00934         T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10)
00935 {
00936         return tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
00937                 t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
00938 }
00939 #endif
00940 // ----
00941 
00942 
00943 template<class T1>
00944 tuple<T1&>  reftpl(T1& t1)
00945 {
00946         return tuple<T1&>(t1);
00947 }
00948 
00949 template<class T1, class T2>
00950 tuple<T1&, T2&>  reftpl(T1& t1, T2& t2)
00951 {
00952         return tuple<T1&, T2&>(t1, t2);
00953 }
00954 
00955 template<class T1, class T2, class T3>
00956 tuple<T1&, T2&, T3&>  reftpl(T1& t1, T2& t2, T3& t3)
00957 {
00958         return tuple<T1&, T2&, T3&>(t1, t2, t3);
00959 }
00960 
00961 template<class T1, class T2, class T3, class T4>
00962 tuple<T1&, T2&, T3&, T4&>  reftpl(T1& t1, T2& t2, T3& t3, T4& t4)
00963 {
00964         return tuple<T1&, T2&, T3&, T4&>(t1, t2, t3, t4);
00965 }
00966 
00967 template<class T1, class T2, class T3, class T4, class T5>
00968 tuple<T1&, T2&, T3&, T4&, T5&>  reftpl(T1& t1,
00969         T2& t2, T3& t3, T4& t4, T5& t5)
00970 {
00971         return tuple<T1&, T2&, T3&, T4&, T5&>(t1, t2, t3, t4, t5);
00972 }
00973 
00974 template<class T1, class T2, class T3, class T4, class T5, class T6>
00975 tuple<T1&, T2&, T3&, T4&, T5&, T6&>  reftpl(T1& t1,
00976         T2& t2, T3& t3, T4& t4, T5& t5, T6& t6)
00977 {
00978         return tuple<T1&, T2&, T3&, T4&, T5&, T6&>(t1, t2, t3, t4, t5, t6);
00979 }
00980 
00981 template<class T1, class T2, class T3, class T4, class T5, class T6, class T7>
00982 tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&>  reftpl(T1& t1,
00983         T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7)
00984 {
00985         return tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&>(t1, t2, t3, t4, t5, t6, t7);
00986 }
00987 
00988 template
00989 <class T1, class T2, class T3, class T4, class T5,
00990  class T6, class T7, class T8>
00991 tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&>  reftpl(T1& t1,
00992         T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8)
00993 {
00994         return tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&>(
00995                 t1, t2, t3, t4, t5, t6, t7, t8);
00996 }
00997 
00998 template
00999 <class T1, class T2, class T3, class T4, class T5,
01000  class T6, class T7, class T8, class T9>
01001 tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&>  reftpl(T1& t1,
01002         T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8, T9& t9)
01003 {
01004         return tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&>(
01005                 t1, t2, t3, t4, t5, t6, t7, t8, t9);
01006 }
01007 
01008 template
01009 <class T1, class T2, class T3, class T4, class T5,
01010  class T6, class T7, class T8, class T9, class T10>
01011 tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&, T10&>  reftpl(T1& t1,
01012         T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8, T9& t9, T10& t10)
01013 {
01014         return tuple<T1&, T2&, T3&, T4&, T5&, T6&, T7&, T8&, T9&, T10&>(
01015                 t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
01016 }
01017 
01018 // ---------------
01019 
01020 namespace internal_details {
01021 
01022 template <int N>
01023 struct apply_tuple_impl { };
01024 
01025 template <>
01026 struct apply_tuple_impl<0>
01027 {
01028         template <class T, class O>
01029         static inline void operate(T& t, O& o) { o.operate(); }
01030         template <class T, class O>
01031         static inline void output(T& t, O& o) { o.output(); }
01032 };
01033 
01034 template <>
01035 struct apply_tuple_impl<1>
01036 {
01037         template <class T, class O>
01038         static inline void operate(T& t, O& o)
01039         { o.operate(t.val(types::number<1>())); }
01040         template <class T, class O>
01041         static inline void output(T& t, O& o)
01042         { o.output(t.val(types::number<1>())); }
01043 };
01044 
01045 template <>
01046 struct apply_tuple_impl<2>
01047 {
01048         template <class T, class O>
01049         static inline void operate(T& t, O& o)
01050         { o.operate(t.val(types::number<1>()), t.val(types::number<2>())); }
01051         template <class T, class O>
01052         static inline void output(T& t, O& o)
01053         { o.output(t.val(types::number<1>()), t.val(types::number<2>())); }
01054 };
01055 
01056 template <>
01057 struct apply_tuple_impl<3>
01058 {
01059         template <class T, class O>
01060         static inline void operate(T& t, O& o)
01061         {
01062                 using namespace types;
01063                 o.operate(t.val(number<1>()), t.val(number<2>()),
01064                                 t.val(number<3>()));
01065         }
01066         template <class T, class O>
01067         static inline void output(T& t, O& o)
01068         {
01069                 using namespace types;
01070                 o.output(t.val(number<1>()), t.val(number<2>()),
01071                                 t.val(number<3>()));
01072         }
01073 };
01074 
01075 template <>
01076 struct apply_tuple_impl<4>
01077 {
01078         template <class T, class O>
01079         static inline void operate(T& t, O& o)
01080         {
01081                 using namespace types;
01082                 o.operate(
01083                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01084                                 t.val(number<4>()));
01085         }
01086         template <class T, class O>
01087         static inline void output(T& t, O& o)
01088         {
01089                 using namespace types;
01090                 o.output(
01091                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01092                                 t.val(number<4>()));
01093         }
01094 };
01095 
01096 template <>
01097 struct apply_tuple_impl<5>
01098 {
01099         template <class T, class O>
01100         static inline void operate(T& t, O& o)
01101         {
01102                 using namespace types;
01103                 o.operate(
01104                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01105                                 t.val(number<4>()), t.val(number<5>()));
01106         }
01107         template <class T, class O>
01108         static inline void output(T& t, O& o)
01109         {
01110                 using namespace types;
01111                 o.output(
01112                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01113                                 t.val(number<4>()), t.val(number<5>()));
01114         }
01115 };
01116 
01117 template <>
01118 struct apply_tuple_impl<6>
01119 {
01120         template <class T, class O>
01121         static inline void operate(T& t, O& o)
01122         {
01123                 using namespace types;
01124                 o.operate(
01125                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01126                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()));
01127         }
01128         template <class T, class O>
01129         static inline void output(T& t, O& o)
01130         {
01131                 using namespace types;
01132                 o.output(
01133                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01134                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()));
01135         }
01136 };
01137 
01138 template <>
01139 struct apply_tuple_impl<7>
01140 {
01141         template <class T, class O>
01142         static inline void operate(T& t, O& o)
01143         {
01144                 using namespace types;
01145                 o.operate(
01146                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01147                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01148                                 t.val(number<7>()));
01149         }
01150         template <class T, class O>
01151         static inline void output(T& t, O& o)
01152         {
01153                 using namespace types;
01154                 o.output(
01155                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01156                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01157                                 t.val(number<7>()));
01158         }
01159 };
01160 
01161 template <>
01162 struct apply_tuple_impl<8>
01163 {
01164         template <class T, class O>
01165         static inline void operate(T& t, O& o)
01166         {
01167                 using namespace types;
01168                 o.operate(
01169                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01170                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01171                                 t.val(number<7>()), t.val(number<8>()));
01172         }
01173         template <class T, class O>
01174         static inline void output(T& t, O& o)
01175         {
01176                 using namespace types;
01177                 o.output(
01178                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01179                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01180                                 t.val(number<7>()), t.val(number<8>()));
01181         }
01182 };
01183 
01184 template <>
01185 struct apply_tuple_impl<9>
01186 {
01187         template <class T, class O>
01188         static inline void operate(T& t, O& o)
01189         {
01190                 using namespace types;
01191                 o.operate(
01192                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01193                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01194                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()));
01195         }
01196         template <class T, class O>
01197         static inline void output(T& t, O& o)
01198         {
01199                 using namespace types;
01200                 o.output(
01201                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01202                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01203                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()));
01204         }
01205 };
01206 
01207 template <>
01208 struct apply_tuple_impl<10>
01209 {
01210         template <class T, class O>
01211         static inline void operate(T& t, O& o)
01212         {
01213                 using namespace types;
01214                 o.operate(
01215                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01216                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01217                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01218                                 t.val(number<10>()));
01219         }
01220         template <class T, class O>
01221         static inline void output(T& t, O& o)
01222         {
01223                 using namespace types;
01224                 o.output(
01225                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01226                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01227                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01228                                 t.val(number<10>()));
01229         }
01230 };
01231 
01232 template <>
01233 struct apply_tuple_impl<11>
01234 {
01235         template <class T, class O>
01236         static inline void operate(T& t, O& o)
01237         {
01238                 using namespace types;
01239                 o.operate(
01240                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01241                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01242                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01243                                 t.val(number<10>()), t.val(number<11>()));
01244         }
01245         template <class T, class O>
01246         static inline void output(T& t, O& o)
01247         {
01248                 using namespace types;
01249                 o.output(
01250                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01251                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01252                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01253                                 t.val(number<10>()), t.val(number<11>()));
01254         }
01255 };
01256 
01257 template <>
01258 struct apply_tuple_impl<12>
01259 {
01260         template <class T, class O>
01261         static inline void operate(T& t, O& o)
01262         {
01263                 using namespace types;
01264                 o.operate(
01265                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01266                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01267                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01268                                 t.val(number<10>()), t.val(number<11>()), t.val(number<12>()));
01269         }
01270         template <class T, class O>
01271         static inline void output(T& t, O& o)
01272         {
01273                 using namespace types;
01274                 o.output(
01275                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01276                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01277                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01278                                 t.val(number<10>()), t.val(number<11>()), t.val(number<12>()));
01279         }
01280 };
01281 
01282 template <>
01283 struct apply_tuple_impl<13>
01284 {
01285         template <class T, class O>
01286         static inline void operate(T& t, O& o)
01287         {
01288                 using namespace types;
01289                 o.operate(
01290                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01291                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01292                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01293                                 t.val(number<10>()), t.val(number<11>()), t.val(number<12>()),
01294                                 t.val(number<13>()));
01295         }
01296         template <class T, class O>
01297         static inline void output(T& t, O& o)
01298         {
01299                 using namespace types;
01300                 o.output(
01301                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01302                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01303                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01304                                 t.val(number<10>()), t.val(number<11>()), t.val(number<12>()),
01305                                 t.val(number<13>()));
01306         }
01307 };
01308 
01309 template <>
01310 struct apply_tuple_impl<14>
01311 {
01312         template <class T, class O>
01313         static inline void operate(T& t, O& o)
01314         {
01315                 using namespace types;
01316                 o.operate(
01317                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01318                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01319                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01320                                 t.val(number<10>()), t.val(number<11>()), t.val(number<12>()),
01321                                 t.val(number<13>()), t.val(number<14>()));
01322         }
01323         template <class T, class O>
01324         static inline void output(T& t, O& o)
01325         {
01326                 using namespace types;
01327                 o.output(
01328                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01329                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01330                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01331                                 t.val(number<10>()), t.val(number<11>()), t.val(number<12>()),
01332                                 t.val(number<13>()), t.val(number<14>()));
01333         }
01334 };
01335 
01336 template <>
01337 struct apply_tuple_impl<15>
01338 {
01339         template <class T, class O>
01340         static inline void operate(T& t, O& o)
01341         {
01342                 using namespace types;
01343                 o.operate(
01344                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01345                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01346                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01347                                 t.val(number<10>()), t.val(number<11>()), t.val(number<12>()),
01348                                 t.val(number<13>()), t.val(number<14>()), t.val(number<15>()));
01349         }
01350         template <class T, class O>
01351         static inline void output(T& t, O& o)
01352         {
01353                 using namespace types;
01354                 o.output(
01355                                 t.val(number<1>()), t.val(number<2>()), t.val(number<3>()),
01356                                 t.val(number<4>()), t.val(number<5>()), t.val(number<6>()),
01357                                 t.val(number<7>()), t.val(number<8>()), t.val(number<9>()),
01358                                 t.val(number<10>()), t.val(number<11>()), t.val(number<12>()),
01359                                 t.val(number<13>()), t.val(number<14>()), t.val(number<15>()));
01360         }
01361 };
01362 
01363 } /* namespace internal_details */
01364 
01365 template <class T, class O>
01366 void apply_tuple(T& t, O& o)
01367 {
01368         internal_details::apply_tuple_impl<T::size>::operate(t, o);
01369 };
01370 template <class T, class O>
01371 void apply_tuple(const T& t, O& o)
01372 {
01373         internal_details::apply_tuple_impl<T::size>::operate(t, o);
01374 };
01375 template <class T, class O>
01376 void apply_tuple_output(T& t, O& o)
01377 {
01378         internal_details::apply_tuple_impl<T::size>::output(t, o);
01379 };
01380 
01381 } /* namespace internal */
01382 
01383 using internal::tuple;
01384 
01385 } /* namespace ivl */
01386 
01387 #endif // IVL_CORE_DETAILS_TOOL_INTERNAL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations