Changeset 987:87f7c54892df in lemon-0.x for src/lemon/maps.h
- Timestamp:
- 11/13/04 18:07:10 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1377
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/maps.h
r977 r987 37 37 public: 38 38 ///\e 39 typedef K Key Type;39 typedef K Key; 40 40 ///\e 41 typedef T Value Type;41 typedef T Value; 42 42 }; 43 43 … … 109 109 110 110 /// This is essentially a wrapper for \c std::map. With addition that 111 /// you can specify a default value different from \c Value Type() .111 /// you can specify a default value different from \c Value() . 112 112 /// 113 113 /// \todo Provide allocator parameter... 114 template <typename K ey, typename T, typename Compare = std::less<Key> >115 class StdMap : public std::map<K ey,T,Compare> {116 typedef std::map<K ey,T,Compare> parent;114 template <typename K, typename T, typename Compare = std::less<K> > 115 class StdMap : public std::map<K,T,Compare> { 116 typedef std::map<K,T,Compare> parent; 117 117 T v; 118 118 typedef typename parent::value_type PairType; 119 119 120 120 public: 121 typedef K ey KeyType;122 typedef T Value Type;123 typedef T& Reference Type;124 typedef const T& ConstReference Type;121 typedef K Key; 122 typedef T Value; 123 typedef T& Reference; 124 typedef const T& ConstReference; 125 125 126 126 … … 144 144 } 145 145 146 Reference Typeoperator[](const Key &k) {146 Reference operator[](const Key &k) { 147 147 return insert(PairType(k,v)).first -> second; 148 148 } 149 ConstReference Typeoperator[](const Key &k) const {149 ConstReference operator[](const Key &k) const { 150 150 typename parent::iterator i = lower_bound(k); 151 151 if (i == parent::end() || parent::key_comp()(k, (*i).first))
Note: See TracChangeset
for help on using the changeset viewer.