File indexing completed on 2025-01-18 09:47:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_PHOENIX_STL_TUPLE_H_
0012 #define BOOST_PHOENIX_STL_TUPLE_H_
0013
0014 #if __cplusplus >= 201402L \
0015 || (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190024210)
0016
0017 #include <tuple>
0018 #include <boost/phoenix/core/argument.hpp>
0019 #include <boost/phoenix/core/call.hpp>
0020 #include <boost/phoenix/core/expression.hpp>
0021 #include <boost/phoenix/core/limits.hpp>
0022 #include <boost/phoenix/core/meta_grammar.hpp>
0023
0024
0025
0026
0027
0028 namespace boost { namespace phoenix { namespace tuple_detail
0029 {
0030
0031 template<typename T>
0032 struct type_wrap
0033 {
0034 typedef T type;
0035 };
0036 template<int N>
0037 struct idx_wrap
0038 {
0039 static constexpr int idx = N;
0040 };
0041 }}}
0042
0043 BOOST_PHOENIX_DEFINE_EXPRESSION(
0044 (boost)(phoenix)(get_with_type),
0045 (proto::terminal<tuple_detail::type_wrap<proto::_> >)(meta_grammar))
0046
0047 BOOST_PHOENIX_DEFINE_EXPRESSION(
0048 (boost)(phoenix)(get_with_idx),
0049 (proto::terminal<proto::_>)(meta_grammar))
0050
0051 namespace boost { namespace phoenix {
0052 namespace impl {
0053 struct get_with_type
0054 {
0055
0056
0057 template<typename T, typename Expr, typename Context>
0058 auto& operator()(T, const Expr& t, const Context& ctx) const
0059 {
0060 using std::get;
0061
0062 using T_ = typename proto::result_of::value<T>::type;
0063 return get<typename T_::type>(boost::phoenix::eval(t, ctx));
0064 }
0065 };
0066
0067 struct get_with_idx
0068 {
0069
0070
0071 template<typename T, typename Expr, typename Context>
0072 auto& operator()(T, const Expr& t, const Context& ctx) const
0073 {
0074 using std::get;
0075
0076 using T_ = typename proto::result_of::value<T>::type;
0077 return get<T_::idx>(boost::phoenix::eval(t, ctx));
0078 }
0079 };
0080 }
0081
0082 template<typename Dummy>
0083 struct default_actions::when<rule::get_with_type, Dummy>
0084 : call<impl::get_with_type, Dummy>
0085 {};
0086 template<typename Dummy>
0087 struct default_actions::when<rule::get_with_idx, Dummy>
0088 : call<impl::get_with_idx, Dummy>
0089 {};
0090
0091 template<typename T, typename Tuple>
0092 inline typename expression::get_with_type<tuple_detail::type_wrap<T>, Tuple>::
0093 type const
0094 get_(const Tuple& t)
0095 {
0096 return expression::get_with_type<tuple_detail::type_wrap<T>, Tuple>::make(
0097 tuple_detail::type_wrap<T>(), t);
0098 }
0099
0100 template<int N, typename Tuple>
0101 inline typename expression::get_with_idx<tuple_detail::idx_wrap<N>, Tuple>::
0102 type const
0103 get_(const Tuple& t)
0104 {
0105 return expression::get_with_idx<tuple_detail::idx_wrap<N>, Tuple>::make(
0106 tuple_detail::idx_wrap<N>(), t);
0107 }
0108
0109 #if 0
0110
0111 namespace placeholders {
0112 #define BOOST_PP_LOCAL_LIMITS (1, BOOST_PHOENIX_ARG_LIMIT)
0113 #define BOOST_PP_LOCAL_MACRO(N) \
0114 const auto uarg##N = \
0115 boost::phoenix::get_<(N)-1>(boost::phoenix::placeholders::arg1);
0116 #include BOOST_PP_LOCAL_ITERATE()
0117 }
0118 #endif
0119
0120 }}
0121
0122 #endif
0123 #endif