]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/metaparse/v1/cpp11/sequence.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / metaparse / v1 / cpp11 / sequence.hpp
1 #ifndef BOOST_METAPARSE_V1_CPP11_SEQUENCE_HPP
2 #define BOOST_METAPARSE_V1_CPP11_SEQUENCE_HPP
3
4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2018.
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/impl/push_front_result.hpp>
10
11 #include <boost/metaparse/v1/get_remaining.hpp>
12 #include <boost/metaparse/v1/get_position.hpp>
13 #include <boost/metaparse/v1/is_error.hpp>
14 #include <boost/metaparse/v1/return_.hpp>
15 #include <boost/metaparse/v1/transform.hpp>
16
17 #include <boost/mpl/eval_if.hpp>
18 #include <boost/mpl/vector.hpp>
19
20 namespace boost
21 {
22 namespace metaparse
23 {
24 namespace v1
25 {
26 template <class... Ps>
27 struct sequence;
28
29 template <>
30 struct sequence<> : return_<boost::mpl::vector<>> {};
31
32 template <class P, class... Ps>
33 struct sequence<P, Ps...>
34 {
35 private:
36 template <class Res>
37 struct apply_unchecked :
38 transform<
39 sequence<Ps...>,
40 impl::push_front_result<Res>
41 >::template apply<
42 typename get_remaining<Res>::type,
43 typename get_position<Res>::type
44 >
45 {};
46 public:
47 typedef sequence type;
48
49 template <class S, class Pos>
50 struct apply :
51 boost::mpl::eval_if<
52 typename is_error<typename P::template apply<S, Pos>>::type,
53 typename P::template apply<S, Pos>,
54 apply_unchecked<typename P::template apply<S, Pos>>
55 >
56 {};
57 };
58 }
59 }
60 }
61
62 #endif