| 1 | /*============================================================================== |
|---|---|
| 2 | Copyright (c) 2005-2008 Hartmut Kaiser |
| 3 | Copyright (c) 2005-2010 Joel de Guzman |
| 4 | Copyright (c) 2010 Thomas Heller |
| 5 | |
| 6 | Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 7 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 8 | ==============================================================================*/ |
| 9 | #ifndef BOOST_PHOENIX_FUSION_AT_HPP |
| 10 | #define BOOST_PHOENIX_FUSION_AT_HPP |
| 11 | |
| 12 | #include <boost/phoenix/core/limits.hpp> |
| 13 | #include <boost/fusion/sequence/intrinsic/at_c.hpp> |
| 14 | #include <boost/phoenix/core/expression.hpp> |
| 15 | #include <boost/phoenix/core/meta_grammar.hpp> |
| 16 | #include <boost/type_traits/remove_reference.hpp> |
| 17 | |
| 18 | BOOST_PHOENIX_DEFINE_EXPRESSION( |
| 19 | (boost)(phoenix)(at_c) |
| 20 | , (proto::terminal<proto::_>) |
| 21 | (meta_grammar) |
| 22 | ) |
| 23 | |
| 24 | namespace boost { namespace phoenix |
| 25 | { |
| 26 | template <typename Dummy> |
| 27 | struct default_actions::when<rule::at_c, Dummy> |
| 28 | : proto::call< |
| 29 | proto::functional::at( |
| 30 | evaluator(proto::_child_c<1>) |
| 31 | , proto::_value(proto::_child_c<0>) |
| 32 | ) |
| 33 | > |
| 34 | {}; |
| 35 | |
| 36 | template <int N, typename Tuple> |
| 37 | inline |
| 38 | typename expression::at_c<mpl::int_<N>, Tuple>::type const |
| 39 | at_c(Tuple const& tuple) |
| 40 | { |
| 41 | return |
| 42 | expression:: |
| 43 | at_c<mpl::int_<N>, Tuple>:: |
| 44 | make(mpl::int_<N>(), tuple); |
| 45 | } |
| 46 | }} |
| 47 | |
| 48 | #endif |
| 49 |
