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