1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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
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>
18 namespace boost { namespace fusion
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
30 template <typename Tag>
33 template <typename Seq, typename Key>
36 typename result_of::equal_to<
37 typename result_of::find<Seq, Key>::type
38 , typename result_of::end<Seq>::type
45 struct has_key_impl<sequence_facade_tag>
47 template <typename Sequence, typename Key>
48 struct apply : Sequence::template has_key<Sequence, Key> {};
52 struct has_key_impl<boost_array_tag>;
55 struct has_key_impl<mpl_sequence_tag>;
58 struct has_key_impl<std_pair_tag>;
63 template <typename Sequence, typename Key>
65 : extension::has_key_impl<typename detail::tag_of<Sequence>::type>::
66 template apply<Sequence, Key>
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&)
75 typedef typename result_of::has_key<Sequence, Key>::type result;