]>
Commit | Line | Data |
---|---|---|
1 | /*============================================================================= | |
2 | Copyright (c) 2001-2011 Joel de Guzman | |
3 | Copyright (c) 2011 Brandon Kohn | |
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 | #if !defined(BOOST_FUSION_MAP_DETAIL_AT_IMPL_HPP) | |
9 | #define BOOST_FUSION_MAP_DETAIL_AT_IMPL_HPP | |
10 | ||
11 | #include <boost/fusion/support/config.hpp> | |
12 | #include <boost/fusion/support/detail/access.hpp> | |
13 | #include <boost/type_traits/is_const.hpp> | |
14 | #include <boost/mpl/at.hpp> | |
15 | #include <boost/mpl/int.hpp> | |
16 | ||
17 | namespace boost { namespace fusion | |
18 | { | |
19 | struct map_tag; | |
20 | ||
21 | namespace extension | |
22 | { | |
23 | template <typename Tag> | |
24 | struct at_impl; | |
25 | ||
26 | template <> | |
27 | struct at_impl<map_tag> | |
28 | { | |
29 | template <typename Sequence, typename N> | |
30 | struct apply | |
31 | { | |
32 | typedef typename | |
33 | mpl::at<typename Sequence::storage_type::types, N>::type | |
34 | element; | |
35 | typedef typename detail::ref_result<element>::type type; | |
36 | ||
37 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
38 | static type | |
39 | call(Sequence& m) | |
40 | { | |
41 | return m.get_data().at_impl(N()); | |
42 | } | |
43 | }; | |
44 | ||
45 | template <typename Sequence, typename N> | |
46 | struct apply<Sequence const, N> | |
47 | { | |
48 | typedef typename | |
49 | mpl::at<typename Sequence::storage_type::types, N>::type | |
50 | element; | |
51 | typedef typename detail::cref_result<element>::type type; | |
52 | ||
53 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
54 | static type | |
55 | call(Sequence const& m) | |
56 | { | |
57 | return m.get_data().at_impl(N()); | |
58 | } | |
59 | }; | |
60 | }; | |
61 | } | |
62 | }} | |
63 | ||
64 | #endif //BOOST_FUSION_MAP_DETAIL_AT_IMPL_HPP |