# HG changeset patch # User deba # Date 1131101713 0 # Node ID 0bb3fb3baffdba564fa7cba8400e244513785914 # Parent 4bfe670710e00c8988306b3a85ca3d6e85e1218c Increment and decrement operator for IterableIntMap::Reference diff -r 4bfe670710e0 -r 0bb3fb3baffd lemon/iterable_maps.h --- a/lemon/iterable_maps.h Fri Nov 04 10:51:35 2005 +0000 +++ b/lemon/iterable_maps.h Fri Nov 04 10:55:13 2005 +0000 @@ -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;