source: NonGTP/Boost/boost/python/detail/map_entry.hpp @ 857

Revision 857, 1.0 KB checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright David Abrahams 2002.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5#ifndef MAP_ENTRY_DWA2002118_HPP
6# define MAP_ENTRY_DWA2002118_HPP
7
8namespace boost { namespace python { namespace detail {
9
10// A trivial type that works well as the value_type of associative
11// vector maps
12template <class Key, class Value>
13struct map_entry
14{
15    map_entry() {}
16    map_entry(Key k) : key(k), value() {}
17    map_entry(Key k, Value v) : key(k), value(v) {}
18   
19    bool operator<(map_entry const& rhs) const
20    {
21        return this->key < rhs.key;
22    }
23       
24    Key key;
25    Value value;
26};
27
28template <class Key, class Value>
29bool operator<(map_entry<Key,Value> const& e, Key const& k)
30{
31    return e.key < k;
32}
33
34template <class Key, class Value>
35bool operator<(Key const& k, map_entry<Key,Value> const& e)
36{
37    return k < e.key;
38}
39
40
41}}} // namespace boost::python::detail
42
43#endif // MAP_ENTRY_DWA2002118_HPP
Note: See TracBrowser for help on using the repository browser.