]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/metaparse/include/boost/metaparse/v1/impl/remove_trailing_no_chars.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / metaparse / include / boost / metaparse / v1 / impl / remove_trailing_no_chars.hpp
1 #ifndef BOOST_METAPARSE_V1_IMPL_REMOVE_TRAILING_NO_CHARS_HPP
2 #define BOOST_METAPARSE_V1_IMPL_REMOVE_TRAILING_NO_CHARS_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/string.hpp>
11 #include <boost/metaparse/v1/impl/push_front_c.hpp>
12
13 namespace boost
14 {
15 namespace metaparse
16 {
17 namespace v1
18 {
19 namespace impl
20 {
21 template <class S>
22 struct remove_trailing_no_chars : S {};
23
24 #ifdef BOOST_METAPARSE_VARIADIC_STRING
25 // this code assumes that BOOST_NO_CHARs are at the end of the string
26 template <char... Cs>
27 struct remove_trailing_no_chars<string<BOOST_NO_CHAR, Cs...>> :
28 string<>
29 {};
30
31 template <char C, char... Cs>
32 struct remove_trailing_no_chars<string<C, Cs...>> :
33 push_front_c<typename remove_trailing_no_chars<string<Cs...>>::type,C>
34 {};
35
36 #ifdef _MSC_VER
37 /*
38 * These specialisations are needed to avoid an internal compiler error
39 * in Visual C++ 12
40 */
41 template <char C>
42 struct remove_trailing_no_chars<string<C>> : string<C> {};
43
44 template <>
45 struct remove_trailing_no_chars<string<BOOST_NO_CHAR>> : string<> {};
46
47 template <>
48 struct remove_trailing_no_chars<string<>> : string<> {};
49 #endif
50 #endif
51 }
52 }
53 }
54 }
55
56 #endif
57