Increment and decrement operator for IterableIntMap::Reference
authordeba
Fri, 04 Nov 2005 10:55:13 +0000
changeset 17590bb3fb3baffd
parent 1758 4bfe670710e0
child 1760 f18e8ca73a8f
Increment and decrement operator for IterableIntMap::Reference
lemon/iterable_maps.h
     1.1 --- a/lemon/iterable_maps.h	Fri Nov 04 10:51:35 2005 +0000
     1.2 +++ b/lemon/iterable_maps.h	Fri Nov 04 10:55:13 2005 +0000
     1.3 @@ -275,7 +275,7 @@
     1.4      typedef int Value;
     1.5      typedef _Graph Graph;
     1.6  
     1.7 -    IterableIntMap(const Graph& graph) : Parent(graph) {}
     1.8 +    explicit IterableIntMap(const Graph& graph) : Parent(graph) {}
     1.9  
    1.10    private:
    1.11      
    1.12 @@ -333,6 +333,24 @@
    1.13  	_map.set(_key, value); 
    1.14  	return *this; 
    1.15        }
    1.16 +      Reference& operator++() {
    1.17 +	_map.set(_key, _map[_key] + 1); 
    1.18 +	return *this; 	
    1.19 +      }
    1.20 +      int operator++(int) {
    1.21 +	int value = _map[_key];
    1.22 +	_map.set(_key, value + 1); 
    1.23 +	return value; 	
    1.24 +      }
    1.25 +      Reference& operator--() {
    1.26 +	_map.set(_key, _map[_key] - 1); 
    1.27 +	return *this; 	
    1.28 +      }
    1.29 +      int operator--(int) {
    1.30 +	int value = _map[_key];
    1.31 +	_map.set(_key, value - 1); 
    1.32 +	return value; 	
    1.33 +      }
    1.34        Reference& operator+=(int value) { 
    1.35  	_map.set(_key, _map[_key] + value); 
    1.36  	return *this;