Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:38

0001 // Copyright David Abrahams 2002.
0002 // Distributed under the Boost Software License, Version 1.0. (See
0003 // accompanying file LICENSE_1_0.txt or copy at
0004 // http://www.boost.org/LICENSE_1_0.txt)
0005 #ifndef MAP_ENTRY_DWA2002118_HPP
0006 # define MAP_ENTRY_DWA2002118_HPP
0007 
0008 namespace boost { namespace python { namespace detail { 
0009 
0010 // A trivial type that works well as the value_type of associative
0011 // vector maps
0012 template <class Key, class Value>
0013 struct map_entry
0014 {
0015     map_entry() {}
0016     map_entry(Key k) : key(k), value() {}
0017     map_entry(Key k, Value v) : key(k), value(v) {}
0018     
0019     bool operator<(map_entry const& rhs) const
0020     {
0021         return this->key < rhs.key;
0022     }
0023         
0024     Key key;
0025     Value value;
0026 };
0027 
0028 template <class Key, class Value>
0029 bool operator<(map_entry<Key,Value> const& e, Key const& k)
0030 {
0031     return e.key < k;
0032 }
0033 
0034 template <class Key, class Value>
0035 bool operator<(Key const& k, map_entry<Key,Value> const& e)
0036 {
0037     return k < e.key;
0038 }
0039 
0040 
0041 }}} // namespace boost::python::detail
0042 
0043 #endif // MAP_ENTRY_DWA2002118_HPP