pair_key_mapped_of_value.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/container for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef BOOST_CONTAINER_PAIR_KEY_MAPPED_OF_VALUE_HPP
  11. #define BOOST_CONTAINER_PAIR_KEY_MAPPED_OF_VALUE_HPP
  12. #ifndef BOOST_CONFIG_HPP
  13. # include <boost/config.hpp>
  14. #endif
  15. #if defined(BOOST_HAS_PRAGMA_ONCE)
  16. # pragma once
  17. #endif
  18. #include <boost/container/detail/config_begin.hpp>
  19. #include <boost/container/detail/workaround.hpp>
  20. namespace boost {
  21. namespace container {
  22. template<class Key, class Mapped>
  23. struct pair_key_mapped_of_value
  24. {
  25. typedef Key key_type;
  26. typedef Mapped mapped_type;
  27. template<class Pair>
  28. const key_type & key_of_value(const Pair &p) const
  29. { return p.first; }
  30. template<class Pair>
  31. const mapped_type & mapped_of_value(const Pair &p) const
  32. { return p.second; }
  33. template<class Pair>
  34. key_type & key_of_value(Pair &p) const
  35. { return const_cast<key_type&>(p.first); }
  36. template<class Pair>
  37. mapped_type & mapped_of_value(Pair &p) const
  38. { return p.second; }
  39. };
  40. }}
  41. #include <boost/container/detail/config_end.hpp>
  42. #endif // BOOST_CONTAINER_PAIR_KEY_MAPPED_OF_VALUE_HPP