COIN-OR::LEMON - Graph Library

Changeset 844:9bf990cb066d in lemon-0.x for src/hugo/sym_map.h


Ignore:
Timestamp:
09/13/04 22:05:13 (20 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1143
Message:

Bug fix in the symmetric maps.
Faster map initialization.
Iterators and Containers STL compatible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hugo/sym_map.h

    r822 r844  
    1818   */
    1919
     20
    2021  template <typename Graph, typename Edge, typename EdgeIt>
    2122  class SymEdgeIt : public EdgeIt {
     
    3132    SymEdgeIt(const Graph& graph)
    3233      : EdgeIt(graph) {
    33       while ( (n & 1) && n != -1) {
     34      while ( (EdgeIt::n & 1) && EdgeIt::n != -1) {
    3435        EdgeIt::operator++();
    3536      }
     
    4546    SymEdgeIt(const Graph& graph, const Edge& edge)
    4647      : EdgeIt(graph, edge) {
    47       while ( (n & 1) && n != -1) {
     48      while ( (EdgeIt::n & 1) && EdgeIt::n != -1) {
    4849        EdgeIt::operator++();
    4950      }
     
    5455    SymEdgeIt& operator++() {
    5556      EdgeIt::operator++();
    56       while ( (n & 1) && n != -1) {
     57      while ( (EdgeIt::n & 1) && EdgeIt::n != -1) {
    5758        EdgeIt::operator++();
    5859      }
     
    122123    }
    123124   
    124     /**
    125      * The subscript operator. The map can be subscripted by the
    126      * actual keys of the graph.
    127      */
    128     typename MapImpl::ReferenceType operator[](const KeyType& key) {
    129       int id = MapImpl::getGraph()->id(key);   
    130       return MapImpl::operator[](id >> 1);
    131     }
    132                
    133     /**
    134      * The const subscript operator. The map can be subscripted by the
    135      * actual keys of the graph.
    136      */
    137     typename MapImpl::ConstReferenceType operator[](const KeyType& key) const {
    138       int id = MapImpl::getGraph()->id(key);
    139       return MapImpl::operator[](id >> 1);
    140     }
    141        
    142     /** Setter function of the map. Equivalent with map[key] = val.
    143      *  This is a compatibility feature with the not dereferable maps.
    144      */
    145     void set(const KeyType& key, const typename MapImpl::ValueType& val) {
    146       int id = MapImpl::getGraph()->id(key);
    147       MapImpl::operator[](id >> 1) = val;
    148     }
    149                
    150125    /** Add a new key to the map. It called by the map registry.
    151126     */
Note: See TracChangeset for help on using the changeset viewer.