get() -> operator[]()
authoralpar
Fri, 19 Mar 2004 21:15:14 +0000
changeset 2106bc65a8a99c6
parent 209 9a37b8d02d74
child 211 9222a9b8b323
get() -> operator[]()
doc/maps.dox
     1.1 --- a/doc/maps.dox	Fri Mar 19 20:58:39 2004 +0000
     1.2 +++ b/doc/maps.dox	Fri Mar 19 21:15:14 2004 +0000
     1.3 @@ -13,21 +13,14 @@
     1.4  \code
     1.5  class MyMap 
     1.6  {
     1.7 -  double get(Graph::EdgeIt e) const { return M_PI;}
     1.8 -};
     1.9 -\endcode
    1.10 -
    1.11 -Or if we accept the new map style, it will look like this:
    1.12 -
    1.13 -\code
    1.14 -class MyMap 
    1.15 -{
    1.16    double operator[](Graph::EdgeIt e) const { return 1;}
    1.17  };
    1.18  \endcode
    1.19  
    1.20  
    1.21 -A more complex example
    1.22 +Here is a more complex example. It provides a length function which is obtained
    1.23 +from a base length function modified by a potential difference.
    1.24 +\todo Please improve on the english. 
    1.25  
    1.26  \code
    1.27  class MyLengthMap 
    1.28 @@ -35,7 +28,9 @@
    1.29    const Graph::EdgeMap &ol;
    1.30    const Graph::NodeMap &pot;
    1.31    
    1.32 -  double get(Graph::EdgeIt e) const { return ol.get(e)-pot.get(v)-pot.get(u);}
    1.33 +  double operator[](Graph::EdgeIt e) const {
    1.34 +    return ol.get(e)-pot.get(v)-pot.get(u);
    1.35 +  }
    1.36    
    1.37    MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) :
    1.38      ol(o), pot(p);