Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:42

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(FUSION_HAS_KEY_09232005_1454)
0008 #define FUSION_HAS_KEY_09232005_1454
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
0012 #include <boost/fusion/support/tag_of.hpp>
0013 #include <boost/fusion/iterator/equal_to.hpp>
0014 #include <boost/fusion/algorithm/query/find.hpp>
0015 #include <boost/fusion/sequence/intrinsic/end.hpp>
0016 #include <boost/mpl/not.hpp>
0017 
0018 namespace boost { namespace fusion
0019 {
0020     struct void_;
0021 
0022     // Special tags:
0023     struct sequence_facade_tag;
0024     struct boost_array_tag; // boost::array tag
0025     struct mpl_sequence_tag; // mpl sequence tag
0026     struct std_pair_tag; // std::pair tag
0027 
0028     namespace extension
0029     {
0030         template <typename Tag>
0031         struct has_key_impl
0032         {
0033             template <typename Seq, typename Key>
0034             struct apply
0035               : mpl::not_<
0036                     typename result_of::equal_to<
0037                         typename result_of::find<Seq, Key>::type
0038                       , typename result_of::end<Seq>::type
0039                     >::type
0040                 >::type
0041             {};
0042         };
0043 
0044         template <>
0045         struct has_key_impl<sequence_facade_tag>
0046         {
0047             template <typename Sequence, typename Key>
0048             struct apply : Sequence::template has_key<Sequence, Key> {};
0049         };
0050 
0051         template <>
0052         struct has_key_impl<boost_array_tag>;
0053 
0054         template <>
0055         struct has_key_impl<mpl_sequence_tag>;
0056 
0057         template <>
0058         struct has_key_impl<std_pair_tag>;
0059     }
0060     
0061     namespace result_of
0062     {
0063         template <typename Sequence, typename Key>
0064         struct has_key 
0065             : extension::has_key_impl<typename detail::tag_of<Sequence>::type>::
0066                 template apply<Sequence, Key>
0067         {};
0068     }
0069 
0070     template <typename Key, typename Sequence>
0071     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0072     inline typename result_of::has_key<Sequence, Key>::type
0073     has_key(Sequence const&)
0074     {
0075         typedef typename result_of::has_key<Sequence, Key>::type result;
0076         return result();
0077     }
0078 }}
0079 
0080 #endif
0081