comparison DEPENDENCIES/generic/include/boost/fusion/sequence/intrinsic/value_at_key.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3 Copyright (c) 2006 Dan Marsden
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(FUSION_VALUE_AT_KEY_05052005_0229)
9 #define FUSION_VALUE_AT_KEY_05052005_0229
10
11 #include <boost/mpl/int.hpp>
12 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
13 #include <boost/fusion/iterator/value_of_data.hpp>
14 #include <boost/fusion/algorithm/query/find.hpp>
15 #include <boost/fusion/support/tag_of.hpp>
16
17 namespace boost { namespace fusion
18 {
19 // Special tags:
20 struct sequence_facade_tag;
21 struct boost_array_tag; // boost::array tag
22 struct mpl_sequence_tag; // mpl sequence tag
23 struct std_pair_tag; // std::pair tag
24
25 namespace extension
26 {
27 template <typename Tag>
28 struct value_at_key_impl
29 {
30 template <typename Seq, typename Key>
31 struct apply
32 : result_of::value_of_data<
33 typename result_of::find<Seq, Key>::type
34 >
35 {};
36 };
37
38 template <>
39 struct value_at_key_impl<sequence_facade_tag>
40 {
41 template <typename Sequence, typename Key>
42 struct apply : Sequence::template value_at_key<Sequence, Key> {};
43 };
44
45 template <>
46 struct value_at_key_impl<boost_array_tag>;
47
48 template <>
49 struct value_at_key_impl<mpl_sequence_tag>;
50
51 template <>
52 struct value_at_key_impl<std_pair_tag>;
53 }
54
55 namespace result_of
56 {
57 template <typename Sequence, typename N>
58 struct value_at_key
59 : extension::value_at_key_impl<typename detail::tag_of<Sequence>::type>::
60 template apply<Sequence, N>
61 {};
62 }
63 }}
64
65 #endif
66