comparison DEPENDENCIES/generic/include/boost/spirit/home/phoenix/fusion/at.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 /*=============================================================================
2 Copyright (c) 2005-2008 Hartmut Kaiser
3 Copyright (c) 2005-2007 Joel de Guzman
4
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #ifndef PHOENIX_SEQUENCE_AT_HPP
9 #define PHOENIX_SEQUENCE_AT_HPP
10
11 #include <boost/fusion/include/at.hpp>
12 #include <boost/spirit/home/phoenix/core/actor.hpp>
13 #include <boost/spirit/home/phoenix/core/compose.hpp>
14 #include <boost/type_traits/remove_reference.hpp>
15
16 namespace boost { namespace phoenix
17 {
18 template <int N>
19 struct at_eval
20 {
21 template <typename Env, typename Tuple>
22 struct result
23 {
24 typedef typename Tuple::template result<Env>::type tuple;
25 typedef typename
26 fusion::result_of::at_c<
27 typename remove_reference<tuple>::type, N
28 >::type
29 type;
30 };
31
32 template <typename RT, typename Env, typename Tuple>
33 static RT
34 eval(Env const& env, Tuple const& t)
35 {
36 return fusion::at_c<N>(t.eval(env));
37 }
38 };
39
40 template <int N, typename Tuple>
41 inline actor<typename as_composite<at_eval<N>, Tuple>::type>
42 at_c(Tuple const& tup)
43 {
44 return compose<at_eval<N> >(tup);
45 }
46
47 }}
48
49 #endif