00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MTL_INDEX_INCLUDE
00013 #define MTL_INDEX_INCLUDE
00014
00015
00016
00017
00018 #include <boost/mpl/if.hpp>
00019
00020 namespace mtl { namespace index {
00021
00022
00023 struct c_index {};
00024
00025
00026 struct f_index {};
00027
00028
00029 #if 0
00030
00031 template <class T> struct which_index
00032 {
00033 typedef typename boost::mpl::if_c<
00034 traits::is_mtl_type<T>::value
00035 , typename T::index_type
00036 , c_index
00037 >::type type;
00038 };
00039 #endif
00040
00041
00042 template <class T> struct which_index
00043 {
00044 typedef typename T::index_type type;
00045 };
00046
00047
00048 template <class T> inline T change_to(c_index, T i)
00049 {
00050 return i;
00051 }
00052
00053 template <class T> inline T change_to(f_index, T i)
00054 {
00055 return i + 1;
00056 }
00057
00058
00059 template <class T> inline T change_from(c_index, T i)
00060 {
00061 return i;
00062 }
00063
00064 template <class T> inline T change_from(f_index, T i)
00065 {
00066 return i - 1;
00067 }
00068
00069 }}
00070
00071 #endif // MTL_INDEX_INCLUDE