1 #ifndef BOOST_METAPARSE_V1_CPP11_IMPL_NTH_OF_C_SKIP_REMANING_HPP 2 #define BOOST_METAPARSE_V1_CPP11_IMPL_NTH_OF_C_SKIP_REMANING_HPP 3 4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2017. 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/is_error.hpp> 10 #include <boost/metaparse/v1/get_remaining.hpp> 11 #include <boost/metaparse/v1/get_position.hpp> 12 #include <boost/metaparse/v1/return_.hpp> 13 14 #include <type_traits> 15 16 namespace boost 17 { 18 namespace metaparse 19 { 20 namespace v1 21 { 22 namespace impl 23 { 24 template <class FinalResult, class S, class Pos, class... Ps> 25 struct nth_of_c_skip_remaining; 26 27 template <class FinalResult, class S, class Pos> 28 struct nth_of_c_skip_remaining<FinalResult, S, Pos> : 29 return_<FinalResult>::template apply<S, Pos> 30 {}; 31 32 template <class FinalResult, class S, class Pos, class P, class... Ps> 33 struct nth_of_c_skip_remaining<FinalResult, S, Pos, P, Ps...> 34 { 35 private: 36 template <class NextResult> 37 struct apply_unchecked : 38 nth_of_c_skip_remaining< 39 FinalResult, 40 typename get_remaining<NextResult>::type, 41 typename get_position<NextResult>::type, 42 Ps... 43 > 44 {}; 45 public: 46 typedef 47 typename std::conditional< 48 is_error<typename P::template apply<S, Pos>>::type::value, 49 typename P::template apply<S, Pos>, 50 apply_unchecked<typename P::template apply<S, Pos>> 51 >::type::type 52 type; 53 }; 54 } 55 } 56 } 57 } 58 59 #endif 60 61