File indexing completed on 2025-01-31 10:02:39
0001
0002
0003
0004
0005
0006
0007
0008
0009 #if !defined(BOOST_SPIRIT_X3_SUBCONTEXT_APR_15_2013_0840AM)
0010 #define BOOST_SPIRIT_X3_SUBCONTEXT_APR_15_2013_0840AM
0011
0012 #include <boost/spirit/home/x3/support/context.hpp>
0013 #include <boost/spirit/home/x3/support/unused.hpp>
0014
0015 namespace boost { namespace spirit { namespace x3
0016 {
0017 template <typename... T>
0018 struct subcontext;
0019
0020 template <>
0021 struct subcontext<>
0022 {
0023 template <typename Context>
0024 subcontext(Context const& )
0025 {}
0026
0027 template <typename ID_>
0028 unused_type
0029 get(ID_) const
0030 {
0031 return unused;
0032 }
0033 };
0034
0035 template <typename T>
0036 struct subcontext<T>
0037 : context<typename T::first_type, typename T::second_type>
0038 {
0039 typedef context<
0040 typename T::first_type, typename T::second_type
0041 > context_type;
0042
0043 template <typename Context>
0044 subcontext(Context const& context)
0045 : context_type(x3::get<typename T::first_type>(context))
0046 {}
0047
0048 using context_type::get;
0049 };
0050
0051 template <typename T, typename... Tail>
0052 struct subcontext<T, Tail...>
0053 : subcontext<Tail...>
0054 , context<
0055 typename T::first_type, typename T::second_type
0056 , subcontext<Tail...>
0057 >
0058 {
0059 typedef subcontext<Tail...> base_type;
0060 typedef context<
0061 typename T::first_type, typename T::second_type
0062 , base_type
0063 > context_type;
0064
0065 template <typename Context>
0066 subcontext(Context const& context)
0067 : base_type(context)
0068 , context_type(
0069 x3::get<typename T::first_type>(context)
0070 , *static_cast<base_type*>(this))
0071 {}
0072
0073 using context_type::get;
0074 };
0075
0076 }}}
0077
0078 #endif