]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2011 Joel de Guzman | |
3 | ||
4 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | ==============================================================================*/ | |
7 | #if !defined(BOOST_FUSION_AT_IMPL_09242011_1744) | |
8 | #define BOOST_FUSION_AT_IMPL_09242011_1744 | |
9 | ||
10 | #include <boost/fusion/support/config.hpp> | |
11 | #include <tuple> | |
12 | #include <utility> | |
13 | #include <boost/mpl/if.hpp> | |
14 | #include <boost/fusion/support/detail/access.hpp> | |
15 | #include <boost/type_traits/remove_const.hpp> | |
16 | ||
17 | namespace boost { namespace fusion | |
18 | { | |
19 | struct std_tuple_tag; | |
20 | ||
21 | namespace extension | |
22 | { | |
23 | template<typename T> | |
24 | struct at_impl; | |
25 | ||
26 | template <> | |
27 | struct at_impl<std_tuple_tag> | |
28 | { | |
29 | template <typename Sequence, typename N> | |
30 | struct apply | |
31 | { | |
32 | typedef typename remove_const<Sequence>::type seq_type; | |
33 | typedef typename std::tuple_element<N::value, seq_type>::type element; | |
34 | ||
35 | typedef typename | |
36 | mpl::if_< | |
37 | is_const<Sequence> | |
38 | , typename fusion::detail::cref_result<element>::type | |
39 | , typename fusion::detail::ref_result<element>::type | |
40 | >::type | |
41 | type; | |
42 | ||
43 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
44 | static type | |
45 | call(Sequence& seq) | |
46 | { | |
47 | return std::get<N::value>(seq); | |
48 | } | |
49 | }; | |
50 | }; | |
51 | } | |
52 | }} | |
53 | ||
54 | #endif |