• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
13 #ifndef BOOST_CONFIG_HPP
14 #  include <boost/config.hpp>
15 #endif
16 
17 #if defined(BOOST_HAS_PRAGMA_ONCE)
18 #  pragma once
19 #endif
20 
21 #include <boost/container/detail/config_begin.hpp>
22 #include <boost/container/detail/workaround.hpp>
23 
24 namespace boost {
25 namespace container {
26 
27 template<class Key, class Mapped>
28 struct pair_key_mapped_of_value
29 {
30    typedef Key    key_type;
31    typedef Mapped mapped_type;
32 
33    template<class Pair>
key_of_valueboost::container::pair_key_mapped_of_value34    const key_type & key_of_value(const Pair &p) const
35    {  return p.first;  }
36 
37    template<class Pair>
mapped_of_valueboost::container::pair_key_mapped_of_value38    const mapped_type & mapped_of_value(const Pair &p) const
39    {  return p.second;  }
40 
41    template<class Pair>
key_of_valueboost::container::pair_key_mapped_of_value42    key_type & key_of_value(Pair &p) const
43    {  return const_cast<key_type&>(p.first);  }
44 
45    template<class Pair>
mapped_of_valueboost::container::pair_key_mapped_of_value46    mapped_type & mapped_of_value(Pair &p) const
47    {  return p.second;  }
48 
49 };
50 
51 }}
52 
53 #include <boost/container/detail/config_end.hpp>
54 
55 #endif   // BOOST_CONTAINER_PAIR_KEY_MAPPED_OF_VALUE_HPP
56