]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/fusion/sequence/intrinsic/has_key.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / fusion / sequence / intrinsic / has_key.hpp
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(FUSION_HAS_KEY_09232005_1454)
8 #define FUSION_HAS_KEY_09232005_1454
9
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
12 #include <boost/fusion/support/tag_of.hpp>
13 #include <boost/fusion/iterator/equal_to.hpp>
14 #include <boost/fusion/algorithm/query/find.hpp>
15 #include <boost/fusion/sequence/intrinsic/end.hpp>
16 #include <boost/mpl/not.hpp>
17
18 namespace boost { namespace fusion
19 {
20 struct void_;
21
22 // Special tags:
23 struct sequence_facade_tag;
24 struct boost_array_tag; // boost::array tag
25 struct mpl_sequence_tag; // mpl sequence tag
26 struct std_pair_tag; // std::pair tag
27
28 namespace extension
29 {
30 template <typename Tag>
31 struct has_key_impl
32 {
33 template <typename Seq, typename Key>
34 struct apply
35 : mpl::not_<
36 typename result_of::equal_to<
37 typename result_of::find<Seq, Key>::type
38 , typename result_of::end<Seq>::type
39 >::type
40 >::type
41 {};
42 };
43
44 template <>
45 struct has_key_impl<sequence_facade_tag>
46 {
47 template <typename Sequence, typename Key>
48 struct apply : Sequence::template has_key<Sequence, Key> {};
49 };
50
51 template <>
52 struct has_key_impl<boost_array_tag>;
53
54 template <>
55 struct has_key_impl<mpl_sequence_tag>;
56
57 template <>
58 struct has_key_impl<std_pair_tag>;
59 }
60
61 namespace result_of
62 {
63 template <typename Sequence, typename Key>
64 struct has_key
65 : extension::has_key_impl<typename detail::tag_of<Sequence>::type>::
66 template apply<Sequence, Key>
67 {};
68 }
69
70 template <typename Key, typename Sequence>
71 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
72 inline typename result_of::has_key<Sequence, Key>::type
73 has_key(Sequence const&)
74 {
75 typedef typename result_of::has_key<Sequence, Key>::type result;
76 return result();
77 }
78 }}
79
80 #endif
81