[Lemon-commits] [lemon_svn] deba: r2291 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:51:34 CET 2006
Author: deba
Date: Fri Nov 4 11:55:13 2005
New Revision: 2291
Modified:
hugo/trunk/lemon/iterable_maps.h
Log:
Increment and decrement operator for IterableIntMap::Reference
Modified: hugo/trunk/lemon/iterable_maps.h
==============================================================================
--- hugo/trunk/lemon/iterable_maps.h (original)
+++ hugo/trunk/lemon/iterable_maps.h Fri Nov 4 11:55:13 2005
@@ -275,7 +275,7 @@
typedef int Value;
typedef _Graph Graph;
- IterableIntMap(const Graph& graph) : Parent(graph) {}
+ explicit IterableIntMap(const Graph& graph) : Parent(graph) {}
private:
@@ -333,6 +333,24 @@
_map.set(_key, value);
return *this;
}
+ Reference& operator++() {
+ _map.set(_key, _map[_key] + 1);
+ return *this;
+ }
+ int operator++(int) {
+ int value = _map[_key];
+ _map.set(_key, value + 1);
+ return value;
+ }
+ Reference& operator--() {
+ _map.set(_key, _map[_key] - 1);
+ return *this;
+ }
+ int operator--(int) {
+ int value = _map[_key];
+ _map.set(_key, value - 1);
+ return value;
+ }
Reference& operator+=(int value) {
_map.set(_key, _map[_key] + value);
return *this;
More information about the Lemon-commits
mailing list