1 #ifndef BOOST_METAPARSE_V1_ALWAYS_HPP
2 #define BOOST_METAPARSE_V1_ALWAYS_HPP
3 
4 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2009 - 2010.
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/accept.hpp>
10 #include <boost/metaparse/v1/is_error.hpp>
11 #include <boost/metaparse/v1/get_remaining.hpp>
12 #include <boost/metaparse/v1/get_position.hpp>
13 
14 #include <boost/mpl/eval_if.hpp>
15 
16 namespace boost
17 {
18   namespace metaparse
19   {
20     namespace v1
21     {
22       template <class P, class Result>
23       struct always
24       {
25       private:
26         template <class Res>
27         struct apply_unchecked :
28           accept<
29             Result,
30             typename get_remaining<Res>::type,
31             typename get_position<Res>::type
32           >
33         {};
34       public:
35         typedef always type;
36 
37         template <class S, class Pos>
38         struct apply :
39           boost::mpl::eval_if<
40             typename is_error<typename P::template apply<S, Pos> >::type,
41             typename P::template apply<S, Pos>,
42             apply_unchecked<typename P::template apply<S, Pos> >
43           >
44         {};
45       };
46     }
47   }
48 }
49 
50 #endif
51 
52