Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:48

0001 #ifndef BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_IMPL_HPP
0002 #define BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_IMPL_HPP
0003 
0004 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2013.
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #include <boost/metaparse/v1/cpp98/impl/skip_seq.hpp>
0010 
0011 #include <boost/mpl/front.hpp>
0012 #include <boost/mpl/pop_front.hpp>
0013 #include <boost/mpl/fold.hpp>
0014 
0015 namespace boost
0016 {
0017   namespace metaparse
0018   {
0019     namespace v1
0020     {
0021       namespace impl
0022       {
0023         template <int N, class Seq>
0024         struct nth_of_c_impl
0025         {
0026         private:
0027           template <class NextResult>
0028           struct apply_unchecked :
0029             nth_of_c_impl<
0030               N - 1,
0031               typename boost::mpl::pop_front<Seq>::type
0032             >::template apply<
0033               typename get_remaining<NextResult>::type,
0034               typename get_position<NextResult>::type
0035             >
0036           {};
0037         public:
0038           typedef nth_of_c_impl type;
0039           
0040           template <class S, class Pos>
0041           struct apply :
0042             boost::mpl::eval_if<
0043               typename is_error<
0044                 typename boost::mpl::front<Seq>::type::template apply<S, Pos>
0045               >::type,
0046               typename boost::mpl::front<Seq>::type::template apply<S, Pos>,
0047               apply_unchecked<
0048                 typename boost::mpl::front<Seq>::type::template apply<S, Pos>
0049               >
0050             >
0051           {};
0052         };
0053         
0054         template <class Seq>
0055         struct nth_of_c_impl<0, Seq>
0056         {
0057           typedef nth_of_c_impl type;
0058           
0059           template <class S, class Pos>
0060           struct apply :
0061             boost::mpl::fold<
0062               typename boost::mpl::pop_front<Seq>::type,
0063               typename boost::mpl::front<Seq>::type::template apply<
0064                 S,
0065                 Pos
0066               >::type,
0067               skip_seq
0068             >
0069           {};
0070         };
0071       }
0072     }
0073   }
0074 }
0075 
0076 #endif
0077