manage_bimap_key.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Boost.Bimap
  2. //
  3. // Copyright (c) 2006-2007 Matias Capeletto
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. /// \file detail/manage_bimap_key.hpp
  9. /// \brief Utility class to manage the set types of a bimap.
  10. #ifndef BOOST_BIMAP_DETAIL_MANAGE_BIMAP_KEY_HPP
  11. #define BOOST_BIMAP_DETAIL_MANAGE_BIMAP_KEY_HPP
  12. #if defined(_MSC_VER)
  13. #pragma once
  14. #endif
  15. #include <boost/config.hpp>
  16. #include <boost/mpl/eval_if.hpp>
  17. #include <boost/mpl/identity.hpp>
  18. #include <boost/bimap/detail/is_set_type_of.hpp>
  19. #include <boost/bimap/set_of.hpp>
  20. namespace boost {
  21. namespace bimaps {
  22. namespace detail {
  23. /** \struct boost::bimaps::detail::manage_bimap_key
  24. \brief Metafunction to manage the set types of a bimap.
  25. \code
  26. template< class Type >
  27. struct manage_bimap_key
  28. {
  29. typedef -SetType- type;
  30. }
  31. \endcode
  32. See also bimap, bimap_core.
  33. **/
  34. #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
  35. template< class Type >
  36. struct manage_bimap_key
  37. {
  38. typedef BOOST_DEDUCED_TYPENAME
  39. mpl::eval_if< BOOST_DEDUCED_TYPENAME is_set_type_of< Type >::type,
  40. // {
  41. mpl::identity< Type >,
  42. // }
  43. // else
  44. // {
  45. // Default it to a set
  46. mpl::identity< set_of< Type > >
  47. // }
  48. >::type set_type;
  49. // Returns set_type and evaluate the concept_checked_type
  50. typedef BOOST_DEDUCED_TYPENAME mpl::if_c< true, set_type,
  51. BOOST_DEDUCED_TYPENAME set_type::lazy_concept_checked::type
  52. >::type type;
  53. };
  54. #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
  55. } // namespace detail
  56. } // namespace bimaps
  57. } // namespace boost
  58. #endif // BOOST_BIMAP_DETAIL_MANAGE_BIMAP_KEY_HPP