summaryrefslogtreecommitdiff
path: root/boost/metaparse
diff options
context:
space:
mode:
Diffstat (limited to 'boost/metaparse')
-rw-r--r--boost/metaparse/v1/cpp11/first_of.hpp36
-rw-r--r--boost/metaparse/v1/cpp11/impl/nth_of_c.hpp82
-rw-r--r--boost/metaparse/v1/cpp11/impl/nth_of_c_skip_remaining.hpp60
-rw-r--r--boost/metaparse/v1/cpp11/last_of.hpp36
-rw-r--r--boost/metaparse/v1/cpp11/nth_of.hpp24
-rw-r--r--boost/metaparse/v1/cpp11/nth_of_c.hpp45
-rw-r--r--boost/metaparse/v1/cpp11/string.hpp11
-rw-r--r--boost/metaparse/v1/cpp98/first_of.hpp35
-rw-r--r--boost/metaparse/v1/cpp98/impl/nth_of_c.hpp (renamed from boost/metaparse/v1/impl/nth_of_c.hpp)6
-rw-r--r--boost/metaparse/v1/cpp98/impl/nth_of_c_impl.hpp (renamed from boost/metaparse/v1/impl/nth_of_c_impl.hpp)6
-rw-r--r--boost/metaparse/v1/cpp98/impl/skip_seq.hpp (renamed from boost/metaparse/v1/impl/skip_seq.hpp)4
-rw-r--r--boost/metaparse/v1/cpp98/last_of.hpp66
-rw-r--r--boost/metaparse/v1/cpp98/nth_of.hpp40
-rw-r--r--boost/metaparse/v1/cpp98/nth_of_c.hpp70
-rw-r--r--boost/metaparse/v1/first_of.hpp31
-rw-r--r--boost/metaparse/v1/last_of.hpp62
-rw-r--r--boost/metaparse/v1/nth_of.hpp35
-rw-r--r--boost/metaparse/v1/nth_of_c.hpp66
18 files changed, 540 insertions, 175 deletions
diff --git a/boost/metaparse/v1/cpp11/first_of.hpp b/boost/metaparse/v1/cpp11/first_of.hpp
new file mode 100644
index 0000000000..a0ad7f4acd
--- /dev/null
+++ b/boost/metaparse/v1/cpp11/first_of.hpp
@@ -0,0 +1,36 @@
+#ifndef BOOST_METAPARSE_V1_CPP11_FIRST_OF_HPP
+#define BOOST_METAPARSE_V1_CPP11_FIRST_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/cpp11/impl/nth_of_c.hpp>
+
+#include <boost/metaparse/v1/fail.hpp>
+#include <boost/metaparse/v1/error/index_out_of_range.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class... Ps>
+ struct first_of
+ {
+ typedef first_of type;
+
+ template <class S, class Pos>
+ struct apply : impl::nth_of_c<0, S, Pos, Ps...> {};
+ };
+
+ template <>
+ struct first_of<> : fail<error::index_out_of_range<0, -1, 0>> {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/cpp11/impl/nth_of_c.hpp b/boost/metaparse/v1/cpp11/impl/nth_of_c.hpp
new file mode 100644
index 0000000000..771e6cd862
--- /dev/null
+++ b/boost/metaparse/v1/cpp11/impl/nth_of_c.hpp
@@ -0,0 +1,82 @@
+#ifndef BOOST_METAPARSE_V1_CPP11_IMPL_NTH_OF_C_HPP
+#define BOOST_METAPARSE_V1_CPP11_IMPL_NTH_OF_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/cpp11/impl/nth_of_c_skip_remaining.hpp>
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/get_result.hpp>
+
+#include <type_traits>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <int N, class S, class Pos, class... Ps>
+ struct nth_of_c;
+
+ template <int N, class S, class Pos, class P, class... Ps>
+ struct nth_of_c<N, S, Pos, P, Ps...>
+ {
+ private:
+ template <class NextResult>
+ struct apply_unchecked :
+ nth_of_c<
+ N - 1,
+ typename get_remaining<NextResult>::type,
+ typename get_position<NextResult>::type,
+ Ps...
+ >
+ {};
+
+ public:
+ typedef
+ typename std::conditional<
+ is_error<typename P::template apply<S, Pos>>::type::value,
+ typename P::template apply<S, Pos>,
+ apply_unchecked<typename P::template apply<S, Pos>>
+ >::type::type
+ type;
+ };
+
+ template <class P, class S, class Pos, class... Ps>
+ struct nth_of_c<0, S, Pos, P, Ps...>
+ {
+ private:
+ template <class NextResult>
+ struct apply_unchecked :
+ nth_of_c_skip_remaining<
+ typename get_result<NextResult>::type,
+ typename get_remaining<NextResult>::type,
+ typename get_position<NextResult>::type,
+ Ps...
+ >
+ {};
+
+ public:
+ typedef
+ typename std::conditional<
+ is_error<typename P::template apply<S, Pos>>::type::value,
+ typename P::template apply<S, Pos>,
+ apply_unchecked<typename P::template apply<S, Pos>>
+ >::type::type
+ type;
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/cpp11/impl/nth_of_c_skip_remaining.hpp b/boost/metaparse/v1/cpp11/impl/nth_of_c_skip_remaining.hpp
new file mode 100644
index 0000000000..072a9774d0
--- /dev/null
+++ b/boost/metaparse/v1/cpp11/impl/nth_of_c_skip_remaining.hpp
@@ -0,0 +1,60 @@
+#ifndef BOOST_METAPARSE_V1_CPP11_IMPL_NTH_OF_C_SKIP_REMANING_HPP
+#define BOOST_METAPARSE_V1_CPP11_IMPL_NTH_OF_C_SKIP_REMANING_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/is_error.hpp>
+#include <boost/metaparse/v1/get_remaining.hpp>
+#include <boost/metaparse/v1/get_position.hpp>
+#include <boost/metaparse/v1/return_.hpp>
+
+#include <type_traits>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ namespace impl
+ {
+ template <class FinalResult, class S, class Pos, class... Ps>
+ struct nth_of_c_skip_remaining;
+
+ template <class FinalResult, class S, class Pos>
+ struct nth_of_c_skip_remaining<FinalResult, S, Pos> :
+ return_<FinalResult>::template apply<S, Pos>
+ {};
+
+ template <class FinalResult, class S, class Pos, class P, class... Ps>
+ struct nth_of_c_skip_remaining<FinalResult, S, Pos, P, Ps...>
+ {
+ private:
+ template <class NextResult>
+ struct apply_unchecked :
+ nth_of_c_skip_remaining<
+ FinalResult,
+ typename get_remaining<NextResult>::type,
+ typename get_position<NextResult>::type,
+ Ps...
+ >
+ {};
+ public:
+ typedef
+ typename std::conditional<
+ is_error<typename P::template apply<S, Pos>>::type::value,
+ typename P::template apply<S, Pos>,
+ apply_unchecked<typename P::template apply<S, Pos>>
+ >::type::type
+ type;
+ };
+ }
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/cpp11/last_of.hpp b/boost/metaparse/v1/cpp11/last_of.hpp
new file mode 100644
index 0000000000..51405a233e
--- /dev/null
+++ b/boost/metaparse/v1/cpp11/last_of.hpp
@@ -0,0 +1,36 @@
+#ifndef BOOST_METAPARSE_V1_CPP11_LAST_OF_HPP
+#define BOOST_METAPARSE_V1_CPP11_LAST_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/cpp11/impl/nth_of_c.hpp>
+
+#include <boost/metaparse/v1/fail.hpp>
+#include <boost/metaparse/v1/error/index_out_of_range.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class... Ps>
+ struct last_of
+ {
+ typedef last_of type;
+
+ template <class S, class Pos>
+ struct apply : impl::nth_of_c<sizeof...(Ps) - 1, S, Pos, Ps...> {};
+ };
+
+ template <>
+ struct last_of<> : fail<error::index_out_of_range<0, -1, 0>> {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/cpp11/nth_of.hpp b/boost/metaparse/v1/cpp11/nth_of.hpp
new file mode 100644
index 0000000000..8900c93bb4
--- /dev/null
+++ b/boost/metaparse/v1/cpp11/nth_of.hpp
@@ -0,0 +1,24 @@
+#ifndef BOOST_METAPARSE_V1_CPP11_NTH_OF_HPP
+#define BOOST_METAPARSE_V1_CPP11_NTH_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/nth_of_c.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <class K, class... Ps>
+ struct nth_of : nth_of_c<K::type::value, Ps...> {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/cpp11/nth_of_c.hpp b/boost/metaparse/v1/cpp11/nth_of_c.hpp
new file mode 100644
index 0000000000..c8cc51dc93
--- /dev/null
+++ b/boost/metaparse/v1/cpp11/nth_of_c.hpp
@@ -0,0 +1,45 @@
+#ifndef BOOST_METAPARSE_V1_CPP11_NTH_OF_C_HPP
+#define BOOST_METAPARSE_V1_CPP11_NTH_OF_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/cpp11/impl/nth_of_c.hpp>
+
+#include <boost/metaparse/v1/fail.hpp>
+#include <boost/metaparse/v1/error/index_out_of_range.hpp>
+
+#include <type_traits>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <int N, class... Ps>
+ struct nth_of_c
+ {
+ typedef nth_of_c type;
+
+ template <class S, class Pos>
+ struct apply :
+ std::conditional<
+ (0 <= N && N < sizeof...(Ps)),
+ impl::nth_of_c<N, S, Pos, Ps...>,
+ typename fail<error::index_out_of_range<0, sizeof...(Ps) - 1, N>>
+ ::template apply<S, Pos>
+ >::type
+ {};
+ };
+
+ template <int N>
+ struct nth_of_c<N> : fail<error::index_out_of_range<0, -1, N>> {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/cpp11/string.hpp b/boost/metaparse/v1/cpp11/string.hpp
index e109b41d98..c2bd95cb19 100644
--- a/boost/metaparse/v1/cpp11/string.hpp
+++ b/boost/metaparse/v1/cpp11/string.hpp
@@ -207,7 +207,16 @@ namespace boost
}
#include <boost/metaparse/v1/cpp11/impl/remove_trailing_no_chars.hpp>
-#include <boost/metaparse/v1/cpp11/impl/string.hpp>
+
+#if __clang__
+# if __has_extension(cxx_string_literal_templates)
+# define BOOST_METAPARSE_V1_STRING(...) ::boost::metaparse::string<__VA_ARGS__>
+# else
+# include <boost/metaparse/v1/cpp11/impl/string.hpp>
+# endif
+#else
+# include <boost/metaparse/v1/cpp11/impl/string.hpp>
+#endif
#endif
diff --git a/boost/metaparse/v1/cpp98/first_of.hpp b/boost/metaparse/v1/cpp98/first_of.hpp
new file mode 100644
index 0000000000..7f27ddabf0
--- /dev/null
+++ b/boost/metaparse/v1/cpp98/first_of.hpp
@@ -0,0 +1,35 @@
+#ifndef BOOST_METAPARSE_V1_CPP98_FIRST_OF_HPP
+#define BOOST_METAPARSE_V1_CPP98_FIRST_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/cpp98/nth_of_c.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct first_of :
+ nth_of_c<
+ 0,
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, P)
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/impl/nth_of_c.hpp b/boost/metaparse/v1/cpp98/impl/nth_of_c.hpp
index d12d164eaa..f71728c62c 100644
--- a/boost/metaparse/v1/impl/nth_of_c.hpp
+++ b/boost/metaparse/v1/cpp98/impl/nth_of_c.hpp
@@ -1,12 +1,12 @@
-#ifndef BOOST_METAPARSE_V1_IMPL_NTH_OF_C_HPP
-#define BOOST_METAPARSE_V1_IMPL_NTH_OF_C_HPP
+#ifndef BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_HPP
+#define BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_HPP
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/metaparse/v1/impl/nth_of_c_impl.hpp>
+#include <boost/metaparse/v1/cpp98/impl/nth_of_c_impl.hpp>
#include <boost/metaparse/v1/error/index_out_of_range.hpp>
#include <boost/metaparse/v1/fail.hpp>
#include <boost/metaparse/limit_sequence_size.hpp>
diff --git a/boost/metaparse/v1/impl/nth_of_c_impl.hpp b/boost/metaparse/v1/cpp98/impl/nth_of_c_impl.hpp
index c74dcc0dae..125267a56e 100644
--- a/boost/metaparse/v1/impl/nth_of_c_impl.hpp
+++ b/boost/metaparse/v1/cpp98/impl/nth_of_c_impl.hpp
@@ -1,12 +1,12 @@
-#ifndef BOOST_METAPARSE_V1_IMPL_NTH_OF_C_IMPL_HPP
-#define BOOST_METAPARSE_V1_IMPL_NTH_OF_C_IMPL_HPP
+#ifndef BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_IMPL_HPP
+#define BOOST_METAPARSE_V1_CPP98_IMPL_NTH_OF_C_IMPL_HPP
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/metaparse/v1/impl/skip_seq.hpp>
+#include <boost/metaparse/v1/cpp98/impl/skip_seq.hpp>
#include <boost/mpl/front.hpp>
#include <boost/mpl/pop_front.hpp>
diff --git a/boost/metaparse/v1/impl/skip_seq.hpp b/boost/metaparse/v1/cpp98/impl/skip_seq.hpp
index 4d7e5b138a..ef4e7c0325 100644
--- a/boost/metaparse/v1/impl/skip_seq.hpp
+++ b/boost/metaparse/v1/cpp98/impl/skip_seq.hpp
@@ -1,5 +1,5 @@
-#ifndef BOOST_METAPARSE_V1_IMPL_SKIP_SEQ_HPP
-#define BOOST_METAPARSE_V1_IMPL_SKIP_SEQ_HPP
+#ifndef BOOST_METAPARSE_V1_CPP98_IMPL_SKIP_SEQ_HPP
+#define BOOST_METAPARSE_V1_CPP98_IMPL_SKIP_SEQ_HPP
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
// Distributed under the Boost Software License, Version 1.0.
diff --git a/boost/metaparse/v1/cpp98/last_of.hpp b/boost/metaparse/v1/cpp98/last_of.hpp
new file mode 100644
index 0000000000..4e5e4756a3
--- /dev/null
+++ b/boost/metaparse/v1/cpp98/last_of.hpp
@@ -0,0 +1,66 @@
+#ifndef BOOST_METAPARSE_V1_CPP98_LAST_OF_HPP
+#define BOOST_METAPARSE_V1_CPP98_LAST_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/cpp98/nth_of_c.hpp>
+
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct last_of;
+
+ #ifdef BOOST_METAPARSE_LAST_OF_N
+ # error BOOST_METAPARSE_LAST_OF_N already defined
+ #endif
+ #define BOOST_METAPARSE_LAST_OF_N(z, n, unused) \
+ template <BOOST_PP_ENUM_PARAMS(n, class P)> \
+ struct last_of< \
+ BOOST_PP_ENUM_PARAMS(n, P) \
+ BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, n), \
+ boost::mpl::na BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > : \
+ impl::BOOST_PP_CAT(nth_of_c, n)< \
+ n - 1 BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, P) \
+ > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ BOOST_METAPARSE_LAST_OF_N,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_LAST_OF_N
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/cpp98/nth_of.hpp b/boost/metaparse/v1/cpp98/nth_of.hpp
new file mode 100644
index 0000000000..94b5613eac
--- /dev/null
+++ b/boost/metaparse/v1/cpp98/nth_of.hpp
@@ -0,0 +1,40 @@
+#ifndef BOOST_METAPARSE_V1_CPP98_NTH_OF_HPP
+#define BOOST_METAPARSE_V1_CPP98_NTH_OF_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/nth_of_c.hpp>
+#include <boost/metaparse/limit_sequence_size.hpp>
+
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ class K,
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct nth_of :
+ nth_of_c<
+ K::type::value,
+ BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, P)
+ >
+ {};
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/cpp98/nth_of_c.hpp b/boost/metaparse/v1/cpp98/nth_of_c.hpp
new file mode 100644
index 0000000000..ae86d31c5b
--- /dev/null
+++ b/boost/metaparse/v1/cpp98/nth_of_c.hpp
@@ -0,0 +1,70 @@
+#ifndef BOOST_METAPARSE_V1_CPP98_NTH_OF_C_HPP
+#define BOOST_METAPARSE_V1_CPP98_NTH_OF_C_HPP
+
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/metaparse/v1/cpp98/impl/nth_of_c.hpp>
+#include <boost/metaparse/limit_sequence_size.hpp>
+
+#include <boost/preprocessor/repetition/repeat.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/tuple/eat.hpp>
+
+namespace boost
+{
+ namespace metaparse
+ {
+ namespace v1
+ {
+ template <
+ int N,
+ BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ class P,
+ boost::mpl::na
+ )
+ >
+ struct nth_of_c;
+
+ #ifdef BOOST_METAPARSE_NTH_OF_N
+ # error BOOST_METAPARSE_NTH_OF_N already defined
+ #endif
+ #define BOOST_METAPARSE_NTH_OF_N(z, n, unused) \
+ template <int K BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class P)> \
+ struct nth_of_c< \
+ K, \
+ BOOST_PP_ENUM_PARAMS(n, P) \
+ BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM( \
+ BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, n), \
+ boost::mpl::na BOOST_PP_TUPLE_EAT(3), \
+ ~ \
+ ) \
+ > : \
+ impl::BOOST_PP_CAT(nth_of_c, n)< \
+ K BOOST_PP_COMMA_IF(n) \
+ BOOST_PP_ENUM_PARAMS(n, P) \
+ > \
+ {};
+
+ BOOST_PP_REPEAT(
+ BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
+ BOOST_METAPARSE_NTH_OF_N,
+ ~
+ )
+
+ #undef BOOST_METAPARSE_NTH_OF_N
+ }
+ }
+}
+
+#endif
+
diff --git a/boost/metaparse/v1/first_of.hpp b/boost/metaparse/v1/first_of.hpp
index 1456dda459..580a9a8204 100644
--- a/boost/metaparse/v1/first_of.hpp
+++ b/boost/metaparse/v1/first_of.hpp
@@ -1,35 +1,18 @@
#ifndef BOOST_METAPARSE_V1_FIRST_OF_HPP
#define BOOST_METAPARSE_V1_FIRST_OF_HPP
-// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/metaparse/v1/nth_of.hpp>
+#include <boost/metaparse/config.hpp>
-namespace boost
-{
- namespace metaparse
- {
- namespace v1
- {
- template <
- BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
- BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
- class P,
- boost::mpl::na
- )
- >
- struct first_of :
- nth_of_c<
- 0,
- BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, P)
- >
- {};
- }
- }
-}
+#if BOOST_METAPARSE_STD >= 2011
+# include <boost/metaparse/v1/cpp11/first_of.hpp>
+#else
+# include <boost/metaparse/v1/cpp98/first_of.hpp>
+#endif
#endif
diff --git a/boost/metaparse/v1/last_of.hpp b/boost/metaparse/v1/last_of.hpp
index 583ed6db3e..678525f9a5 100644
--- a/boost/metaparse/v1/last_of.hpp
+++ b/boost/metaparse/v1/last_of.hpp
@@ -1,66 +1,18 @@
#ifndef BOOST_METAPARSE_V1_LAST_OF_HPP
#define BOOST_METAPARSE_V1_LAST_OF_HPP
-// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010.
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/metaparse/v1/nth_of.hpp>
+#include <boost/metaparse/config.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/punctuation/comma_if.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
-#include <boost/preprocessor/repetition/enum.hpp>
-#include <boost/preprocessor/repetition/repeat.hpp>
-#include <boost/preprocessor/arithmetic/sub.hpp>
-#include <boost/preprocessor/tuple/eat.hpp>
-
-namespace boost
-{
- namespace metaparse
- {
- namespace v1
- {
- template <
- BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
- BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
- class P,
- boost::mpl::na
- )
- >
- struct last_of;
-
- #ifdef BOOST_METAPARSE_LAST_OF_N
- # error BOOST_METAPARSE_LAST_OF_N already defined
- #endif
- #define BOOST_METAPARSE_LAST_OF_N(z, n, unused) \
- template <BOOST_PP_ENUM_PARAMS(n, class P)> \
- struct last_of< \
- BOOST_PP_ENUM_PARAMS(n, P) \
- BOOST_PP_COMMA_IF(n) \
- BOOST_PP_ENUM( \
- BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, n), \
- boost::mpl::na BOOST_PP_TUPLE_EAT(3), \
- ~ \
- ) \
- > : \
- impl::BOOST_PP_CAT(nth_of_c, n)< \
- n - 1 BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, P) \
- > \
- {};
-
- BOOST_PP_REPEAT(
- BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
- BOOST_METAPARSE_LAST_OF_N,
- ~
- )
-
- #undef BOOST_METAPARSE_LAST_OF_N
- }
- }
-}
+#if BOOST_METAPARSE_STD >= 2011
+# include <boost/metaparse/v1/cpp11/last_of.hpp>
+#else
+# include <boost/metaparse/v1/cpp98/last_of.hpp>
+#endif
#endif
diff --git a/boost/metaparse/v1/nth_of.hpp b/boost/metaparse/v1/nth_of.hpp
index 843733a91d..c3f581ee7b 100644
--- a/boost/metaparse/v1/nth_of.hpp
+++ b/boost/metaparse/v1/nth_of.hpp
@@ -1,39 +1,18 @@
#ifndef BOOST_METAPARSE_V1_NTH_OF_HPP
#define BOOST_METAPARSE_V1_NTH_OF_HPP
-// Copyright Abel Sinkovics (abel@sinkovics.hu) 2010.
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/metaparse/v1/nth_of_c.hpp>
+#include <boost/metaparse/config.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
-
-namespace boost
-{
- namespace metaparse
- {
- namespace v1
- {
- template <
- class K,
- BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
- BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
- class P,
- boost::mpl::na
- )
- >
- struct nth_of :
- nth_of_c<
- K::type::value,
- BOOST_PP_ENUM_PARAMS(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, P)
- >
- {};
- }
- }
-}
+#if BOOST_METAPARSE_STD >= 2011
+# include <boost/metaparse/v1/cpp11/nth_of.hpp>
+#else
+# include <boost/metaparse/v1/cpp98/nth_of.hpp>
+#endif
#endif
diff --git a/boost/metaparse/v1/nth_of_c.hpp b/boost/metaparse/v1/nth_of_c.hpp
index 12af00a224..803f5044f2 100644
--- a/boost/metaparse/v1/nth_of_c.hpp
+++ b/boost/metaparse/v1/nth_of_c.hpp
@@ -1,70 +1,18 @@
#ifndef BOOST_METAPARSE_V1_NTH_OF_C_HPP
#define BOOST_METAPARSE_V1_NTH_OF_C_HPP
-// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
+// Copyright Abel Sinkovics (abel@sinkovics.hu) 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#include <boost/metaparse/v1/impl/nth_of_c.hpp>
-#include <boost/metaparse/limit_sequence_size.hpp>
+#include <boost/metaparse/config.hpp>
-#include <boost/preprocessor/repetition/repeat.hpp>
-#include <boost/preprocessor/repetition/enum.hpp>
-#include <boost/preprocessor/punctuation/comma_if.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
-#include <boost/preprocessor/arithmetic/sub.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/tuple/eat.hpp>
-
-namespace boost
-{
- namespace metaparse
- {
- namespace v1
- {
- template <
- int N,
- BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
- BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
- class P,
- boost::mpl::na
- )
- >
- struct nth_of_c;
-
- #ifdef BOOST_METAPARSE_NTH_OF_N
- # error BOOST_METAPARSE_NTH_OF_N already defined
- #endif
- #define BOOST_METAPARSE_NTH_OF_N(z, n, unused) \
- template <int K BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class P)> \
- struct nth_of_c< \
- K, \
- BOOST_PP_ENUM_PARAMS(n, P) \
- BOOST_PP_COMMA_IF(n) \
- BOOST_PP_ENUM( \
- BOOST_PP_SUB(BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE, n), \
- boost::mpl::na BOOST_PP_TUPLE_EAT(3), \
- ~ \
- ) \
- > : \
- impl::BOOST_PP_CAT(nth_of_c, n)< \
- K BOOST_PP_COMMA_IF(n) \
- BOOST_PP_ENUM_PARAMS(n, P) \
- > \
- {};
-
- BOOST_PP_REPEAT(
- BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
- BOOST_METAPARSE_NTH_OF_N,
- ~
- )
-
- #undef BOOST_METAPARSE_NTH_OF_N
- }
- }
-}
+#if BOOST_METAPARSE_STD >= 2011
+# include <boost/metaparse/v1/cpp11/nth_of_c.hpp>
+#else
+# include <boost/metaparse/v1/cpp98/nth_of_c.hpp>
+#endif
#endif