Using proper return type
authordeba
Fri, 14 Oct 2005 11:00:40 +0000
changeset 172522752dd6c693
parent 1724 b20777184ba8
child 1726 f214631ea1ac
Using proper return type
lemon/graph_adaptor.h
lemon/maps.h
     1.1 --- a/lemon/graph_adaptor.h	Fri Oct 14 10:58:54 2005 +0000
     1.2 +++ b/lemon/graph_adaptor.h	Fri Oct 14 11:00:40 2005 +0000
     1.3 @@ -1526,13 +1526,14 @@
     1.4  	else {exit.set(key, val); }
     1.5        }
     1.6        
     1.7 -      typename ReferenceMapTraits<NodeImpl>::Reference 
     1.8 +      typename MapTraits<NodeImpl>::ReturnValue 
     1.9        operator[](const Node& key) {
    1.10  	if (key.entry) { return entry[key]; }
    1.11  	else { return exit[key]; }
    1.12        }
    1.13  
    1.14 -      T operator[](const Node& key) const {
    1.15 +      typename MapTraits<NodeImpl>::ConstReturnValue
    1.16 +      operator[](const Node& key) const {
    1.17  	if (key.entry) { return entry[key]; }
    1.18  	else { return exit[key]; }
    1.19        }
    1.20 @@ -1556,13 +1557,14 @@
    1.21  	else {bind.set(key.bind, val); }
    1.22        }
    1.23        
    1.24 -      typename ReferenceMapTraits<EdgeImpl>::Reference
    1.25 +      typename MapTraits<EdgeImpl>::ReturnValue
    1.26        operator[](const Edge& key) {
    1.27  	if ((typename Parent::Edge&)key != INVALID) { return orig[key]; }
    1.28  	else {return bind[key.bind]; }
    1.29        }
    1.30  
    1.31 -      T operator[](const Edge& key) const {
    1.32 +      typename MapTraits<EdgeImpl>::ConstReturnValue
    1.33 +      operator[](const Edge& key) const {
    1.34  	if ((typename Parent::Edge&)key != INVALID) { return orig[key]; }
    1.35  	else {return bind[key.bind]; }
    1.36        }
     2.1 --- a/lemon/maps.h	Fri Oct 14 10:58:54 2005 +0000
     2.2 +++ b/lemon/maps.h	Fri Oct 14 11:00:40 2005 +0000
     2.3 @@ -18,7 +18,7 @@
     2.4  #define LEMON_MAPS_H
     2.5  
     2.6  #include <lemon/utility.h>
     2.7 -
     2.8 +#include <lemon/traits.h>
     2.9  
    2.10  ///\file
    2.11  ///\ingroup maps
    2.12 @@ -521,7 +521,9 @@
    2.13  
    2.14      ///Constructor
    2.15      ComposeMap(const M1 &_m1,const M2 &_m2) : m1(_m1), m2(_m2) {};
    2.16 -    Value operator[](Key k) const {return m1[m2[k]];}
    2.17 +    
    2.18 +    typename MapTraits<M1>::ConstReturnValue
    2.19 +    operator[](Key k) const {return m1[m2[k]];}
    2.20    };
    2.21    ///Returns a \ref ComposeMap class
    2.22