Mirror reflection library 0.5.13
|
00001 00010 #ifndef MIRROR_CT_STRING_HEAD_1105240825_HPP 00011 #define MIRROR_CT_STRING_HEAD_1105240825_HPP 00012 00013 #include <mirror/ct_string/default.hpp> 00014 00015 MIRROR_NAMESPACE_BEGIN 00016 namespace cts { 00017 namespace aux { 00018 00019 template < 00020 typename Count, 00021 typename Done, 00022 typename Head, 00023 typename Tail 00024 > struct head_hlp; 00025 00026 template <int N, typename Char, Char ... C> 00027 struct head_hlp< 00028 std::integral_constant<int, N>, 00029 std::false_type, 00030 basic_string<Char, C...>, 00031 basic_string<Char> 00032 > 00033 { 00034 typedef basic_string<Char, C...> type; 00035 }; 00036 00037 template <typename Char, Char ... Hn, Char ... Tn> 00038 struct head_hlp< 00039 std::integral_constant<int, 0>, 00040 std::true_type, 00041 basic_string<Char, Hn...>, 00042 basic_string<Char, Tn...> 00043 > 00044 { 00045 typedef basic_string<Char, Hn...> type; 00046 }; 00047 00048 template <int N, typename Char, Char C, Char ... Hn, Char ... Tn> 00049 struct head_hlp< 00050 std::integral_constant<int, N>, 00051 std::false_type, 00052 basic_string<Char, Hn...>, 00053 basic_string<Char, C, Tn...> 00054 > : head_hlp< 00055 std::integral_constant<int, N - 1>, 00056 std::integral_constant<bool, N - 1 == 0>, 00057 basic_string<Char, Hn..., C>, 00058 basic_string<Char, Tn...> 00059 > { }; 00060 00061 } // namespace aux 00062 00063 template <typename Length, typename Char, Char ... C> 00064 struct head< 00065 basic_string<Char, C...>, 00066 Length 00067 > : aux::head_hlp< 00068 std::integral_constant<int, Length::value>, 00069 std::integral_constant<bool, Length::value == 0>, 00070 basic_string<Char>, 00071 basic_string<Char, C...> 00072 > { }; 00073 00074 template <typename CTString, int Length> 00075 struct head_c 00076 : head< 00077 typename CTString::type, 00078 std::integral_constant<int, Length> 00079 > { }; 00080 00081 } // namespace cts 00082 MIRROR_NAMESPACE_END 00083 00084 #endif //include guard 00085