• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef BOOST_METAPARSE_V1_CPP11_FIRST_OF_HPP
2 #define BOOST_METAPARSE_V1_CPP11_FIRST_OF_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/cpp11/impl/nth_of_c.hpp>
10 
11 #include <boost/metaparse/v1/fail.hpp>
12 #include <boost/metaparse/v1/error/index_out_of_range.hpp>
13 
14 namespace boost
15 {
16   namespace metaparse
17   {
18     namespace v1
19     {
20       template <class... Ps>
21       struct first_of
22       {
23         typedef first_of type;
24 
25         template <class S, class Pos>
26         struct apply : impl::nth_of_c<0, S, Pos, Ps...> {};
27       };
28 
29       template <>
30       struct first_of<> : fail<error::index_out_of_range<0, -1, 0>> {};
31     }
32   }
33 }
34 
35 #endif
36 
37