]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #ifndef BOOST_METAPARSE_V1_IMPL_POP_BACK_HPP |
2 | #define BOOST_METAPARSE_V1_IMPL_POP_BACK_HPP | |
3 | ||
4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. | |
5 | // Distributed under the Boost Software License, Version 1.0. | |
6 | // (See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | #include <boost/metaparse/config.hpp> | |
10 | #include <boost/metaparse/v1/fwd/string.hpp> | |
11 | #include <boost/metaparse/v1/impl/push_front_c.hpp> | |
12 | #include <boost/metaparse/v1/impl/size.hpp> | |
13 | #include <boost/metaparse/v1/impl/update_c.hpp> | |
14 | ||
15 | #include <boost/mpl/clear.hpp> | |
16 | ||
17 | namespace boost | |
18 | { | |
19 | namespace metaparse | |
20 | { | |
21 | namespace v1 | |
22 | { | |
23 | namespace impl | |
24 | { | |
25 | template <class S> | |
26 | struct pop_back; | |
27 | ||
28 | #ifdef BOOST_METAPARSE_VARIADIC_STRING | |
29 | template <char C> | |
30 | struct pop_back<string<C>> : boost::mpl::clear<string<C>> {}; | |
31 | ||
32 | template <char C, char... Cs> | |
33 | struct pop_back<string<C, Cs...>> : | |
34 | push_front_c<typename pop_back<string<Cs...>>::type, C> | |
35 | {}; | |
36 | #else | |
37 | template <class S> | |
38 | struct pop_back : | |
39 | update_c< | |
40 | typename S::type, | |
41 | size<typename S::type>::type::value - 1, | |
42 | BOOST_NO_CHAR | |
43 | > | |
44 | {}; | |
45 | #endif | |
46 | } | |
47 | } | |
48 | } | |
49 | } | |
50 | ||
51 | #endif | |
52 |