]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/metaparse/v1/cpp11/impl/remove_trailing_no_chars.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / metaparse / v1 / cpp11 / impl / remove_trailing_no_chars.hpp
1 #ifndef BOOST_METAPARSE_V1_CPP11_IMPL_REMOVE_TRAILING_NO_CHARS_HPP
2 #define BOOST_METAPARSE_V1_CPP11_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/v1/cpp11/string.hpp>
10 #include <boost/metaparse/v1/impl/no_char.hpp>
11 #include <boost/metaparse/v1/cpp11/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 // this code assumes that BOOST_NO_CHARs are at the end of the string
25 template <char... Cs>
26 struct remove_trailing_no_chars<string<BOOST_NO_CHAR, Cs...>> :
27 string<>
28 {};
29
30 template <char C, char... Cs>
31 struct remove_trailing_no_chars<string<C, Cs...>> :
32 push_front_c<typename remove_trailing_no_chars<string<Cs...>>::type,C>
33 {};
34
35 #ifdef _MSC_VER
36 /*
37 * These specialisations are needed to avoid an internal compiler error
38 * in Visual C++ 12
39 */
40 template <char C>
41 struct remove_trailing_no_chars<string<C>> : string<C> {};
42
43 template <>
44 struct remove_trailing_no_chars<string<BOOST_NO_CHAR>> : string<> {};
45
46 template <>
47 struct remove_trailing_no_chars<string<>> : string<> {};
48 #endif
49 }
50 }
51 }
52 }
53
54 #endif
55