Mirror reflection library 0.5.13

mirror/ct_string/tail.hpp

Go to the documentation of this file.
00001 
00010 #ifndef MIRROR_CT_STRING_TAIL_1105240825_HPP
00011 #define MIRROR_CT_STRING_TAIL_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 tail_hlp;
00025 
00026 template <int N, typename Char, Char ... C>
00027 struct tail_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> type;
00035 };
00036 
00037 template <int N, typename Char, Char ... Hn, Char ... Tn>
00038 struct tail_hlp<
00039     std::integral_constant<int, N>,
00040     std::true_type,
00041     basic_string<Char, Hn...>,
00042     basic_string<Char, Tn...>
00043 >
00044 {
00045     typedef basic_string<Char, Tn...> type;
00046 };
00047 
00048 template <int N, typename Char, Char C, Char ... Hn, Char ... Tn>
00049 struct tail_hlp<
00050     std::integral_constant<int, N>,
00051     std::false_type,
00052     basic_string<Char, Hn...>,
00053     basic_string<Char, C, Tn...>
00054 > : tail_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 tail<
00065     basic_string<Char, C...>,
00066     Length
00067 > : aux::tail_hlp<
00068     std::integral_constant<
00069         int,
00070         length<basic_string<Char, C...> >::value -
00071         Length::value
00072     >,
00073     std::integral_constant<
00074         bool,
00075         length<basic_string<Char, C...> >::value <=
00076         Length::value
00077     >,
00078     basic_string<Char>,
00079     basic_string<Char, C...>
00080 > { };
00081 
00082 template <typename CTString, int Length>
00083 struct tail_c
00084  : tail<
00085     typename CTString::type,
00086     std::integral_constant<int, Length>
00087 > { };
00088 
00089 } // namespace cts
00090 MIRROR_NAMESPACE_END
00091 
00092 #endif //include guard
00093 

Copyright © 2006-2011 Matus Chochlik, University of Zilina, Zilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Fri Dec 16 2011 by Doxygen (version 1.7.3).
Important note: Although the 'boostified' version of Mirror uses the Boost C++ libraries Coding Guidelines and is implemented inside of the boost namespace, it IS NOT an officially reviewed and accepted Boost library. Mirror is being developed with the intention to be submitted for review for inclusion to the Boost C++ libraries.