ivl 679
ivl/details/core/ivl_func/tools/get_1st_elem_type.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_IVL_FUNC_TOOLS_GET_1ST_ELEM_TYPE_HPP
00025 #define IVL_CORE_DETAILS_IVL_FUNC_TOOLS_GET_1ST_ELEM_TYPE_HPP
00026 
00027 namespace ivl {
00028 
00029 namespace core_details {
00030 
00031 namespace get_1st_elem_type_details {
00032 
00033 template <class TUP, int I, int E, class VT, class IS_C>
00034 struct get_1st_t_op_3 { };
00035 
00036 template <class TUP, int I, int E, class VT>
00037 struct get_1st_t_op_2
00038 : public get_1st_t_op_3<TUP, I, E, VT, typename types::is_ivl_array<VT>::type>
00039 {
00040 };
00041 
00042 template <class TUP, int I, int E>
00043 struct get_1st_t_op_1
00044 : public get_1st_t_op_2<TUP, I, E, typename TUP::template val_t<I>::type>
00045 {
00046 };
00047 
00048 template <class TUP, int I>
00049 struct get_1st_t_op_1<TUP, I, E>
00050 {
00051         // If there is an error here you probably supplied
00052         // a wrong argument to a template rvalue-func function.
00053         // no ::type
00054 };
00055 
00056 // specializations
00057 template <class TUP, int I, int E, class VT>
00058 struct get_1st_t_op_3 <TUP, I, E, VT, types::t_true>
00059 {
00060         typedef typename VT::elem_type type;
00061 };
00062 
00063 template <class TUP, int I, int E, class VT>
00064 struct get_1st_t_op_3 <TUP, I, E, VT, types::t_false>
00065 {
00066         typedef typename get_1st_t_op1<TUP, I + 1, E>::type type;
00067 };
00068 
00069 } /* namespace get_1st_elem_type_details */
00070 
00071 template <class TUP>
00072 struct get_1st_elem_type
00073 {
00074         typedef typename get_1st_elem_type_details::
00075                 get_1st_t_op_1<TUP, 1, TUP::size + 1>::type type;
00076 };
00077 
00078 } /* namespace core_details */
00079 
00080 } /* namespace ivl */
00081 
00082 #endif // IVL_CORE_DETAILS_IVL_FUNC_TOOLS_GET_1ST_ELEM_TYPE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations