]>
Commit | Line | Data |
---|---|---|
1 | /*============================================================================= | |
2 | Copyright (c) 2001-2013 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_MAP_DETAIL_AT_KEY_IMPL_02042013_0821) | |
8 | #define BOOST_FUSION_MAP_DETAIL_AT_KEY_IMPL_02042013_0821 | |
9 | ||
10 | #include <boost/fusion/support/config.hpp> | |
11 | #include <boost/fusion/support/detail/access.hpp> | |
12 | #include <boost/type_traits/is_const.hpp> | |
13 | #include <boost/mpl/at.hpp> | |
14 | #include <boost/mpl/identity.hpp> | |
15 | #include <boost/utility/declval.hpp> | |
16 | ||
17 | namespace boost { namespace fusion | |
18 | { | |
19 | struct map_tag; | |
20 | ||
21 | namespace extension | |
22 | { | |
23 | template <typename Tag> | |
24 | struct at_key_impl; | |
25 | ||
26 | template <> | |
27 | struct at_key_impl<map_tag> | |
28 | { | |
29 | template <typename Sequence, typename Key> | |
30 | struct apply | |
31 | { | |
32 | typedef | |
33 | decltype(boost::declval<Sequence>().get(mpl::identity<Key>())) | |
34 | type; | |
35 | ||
36 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
37 | static type | |
38 | call(Sequence& m) | |
39 | { | |
40 | return m.get(mpl::identity<Key>()); | |
41 | } | |
42 | }; | |
43 | ||
44 | template <typename Sequence, typename Key> | |
45 | struct apply<Sequence const, Key> | |
46 | { | |
47 | typedef | |
48 | decltype(boost::declval<Sequence const>().get(mpl::identity<Key>())) | |
49 | type; | |
50 | ||
51 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
52 | static type | |
53 | call(Sequence const& m) | |
54 | { | |
55 | return m.get(mpl::identity<Key>()); | |
56 | } | |
57 | }; | |
58 | }; | |
59 | } | |
60 | }} | |
61 | ||
62 | #endif |