Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef BOOST_METAPARSE_V1_CPP11_NTH_OF_C_HPP
0002 #define BOOST_METAPARSE_V1_CPP11_NTH_OF_C_HPP
0003 
0004 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2017.
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/cpp11/impl/nth_of_c.hpp>
0010 
0011 #include <boost/metaparse/v1/fail.hpp>
0012 #include <boost/metaparse/v1/error/index_out_of_range.hpp>
0013 
0014 #include <type_traits>
0015 
0016 namespace boost
0017 {
0018   namespace metaparse
0019   {
0020     namespace v1
0021     {
0022       template <int N, class... Ps>
0023       struct nth_of_c
0024       {
0025         typedef nth_of_c type;
0026 
0027         template <class S, class Pos>
0028         struct apply :
0029           std::conditional<
0030             (0 <= N && N < sizeof...(Ps)),
0031             impl::nth_of_c<N, S, Pos, Ps...>,
0032             typename fail<error::index_out_of_range<0, sizeof...(Ps) - 1, N>>
0033               ::template apply<S, Pos>
0034           >::type
0035         {};
0036       };
0037 
0038       template <int N>
0039       struct nth_of_c<N> : fail<error::index_out_of_range<0, -1, N>> {};
0040     }
0041   }
0042 }
0043 
0044 #endif
0045