has_key_impl.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2005-2006 Dan Marsden
  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_HAS_KEY_IMPL_20060223_2156)
  8. #define BOOST_FUSION_HAS_KEY_IMPL_20060223_2156
  9. #include <boost/type_traits/is_same.hpp>
  10. #include <boost/mpl/or.hpp>
  11. namespace fields
  12. {
  13. struct name;
  14. struct age;
  15. }
  16. namespace example
  17. {
  18. struct example_sequence_tag;
  19. }
  20. namespace boost { namespace fusion {
  21. namespace extension
  22. {
  23. template<typename Tag>
  24. struct has_key_impl;
  25. template<>
  26. struct has_key_impl<example::example_sequence_tag>
  27. {
  28. template<typename Sequence, typename Key>
  29. struct apply
  30. : mpl::or_<
  31. is_same<Key, fields::name>,
  32. is_same<Key, fields::age> >
  33. {};
  34. };
  35. }
  36. }}
  37. #endif