COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
04/03/06 11:45:23 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2670
Message:

Correcting the structure of the graph's and adaptor's map.
The template assign operators and map iterators can be used for adaptors also.

Some bugfix in the adaptors

New class SwapBpUGraphAdaptor which swaps the two nodeset of the graph.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bits/edge_set_extender.h

    r1999 r2031  
    102102
    103103      explicit NodeIt(const Graph& _graph) : graph(&_graph) {
    104         _graph.first(*static_cast<Node*>(this));
     104        _graph.first(static_cast<Node&>(*this));
    105105      }
    106106
     
    125125
    126126      explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
    127         _graph.first(*static_cast<Edge*>(this));
     127        _graph.first(static_cast<Edge&>(*this));
    128128      }
    129129
     
    236236      template <typename CMap>
    237237      EdgeMap& operator=(const CMap& cmap) {
    238         checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
    239         const typename Parent::Graph* graph = Parent::getGraph();
    240         Edge it;
    241         for (graph->first(it); it != INVALID; graph->next(it)) {
    242           Parent::set(it, cmap[it]);
    243         }
     238        Parent::operator=(cmap);
    244239        return *this;
    245240      }
     241
    246242    };
    247243
     
    365361
    366362      explicit NodeIt(const Graph& _graph) : graph(&_graph) {
    367         _graph.first(*static_cast<Node*>(this));
     363        _graph.first(static_cast<Node&>(*this));
    368364      }
    369365
     
    388384
    389385      explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
    390         _graph.first(*static_cast<Edge*>(this));
     386        _graph.first(static_cast<Edge&>(*this));
    391387      }
    392388
     
    459455
    460456      explicit UEdgeIt(const Graph& _graph) : graph(&_graph) {
    461         _graph.first(*static_cast<UEdge*>(this));
     457        _graph.first(static_cast<UEdge&>(*this));
    462458      }
    463459
     
    557553      template <typename CMap>
    558554      EdgeMap& operator=(const CMap& cmap) {
    559         checkConcept<concept::ReadMap<Edge, _Value>, CMap>();
    560         const typename Parent::Graph* graph = Parent::getGraph();
    561         Edge it;
    562         for (graph->first(it); it != INVALID; graph->next(it)) {
    563           Parent::set(it, cmap[it]);
    564         }
     555        Parent::operator=(cmap);
    565556        return *this;
    566557      }
     558
    567559    };
    568560
     
    577569      UEdgeMap(const Graph& _g)
    578570        : Parent(_g) {}
     571
    579572      UEdgeMap(const Graph& _g, const _Value& _v)
    580573        : Parent(_g, _v) {}
     
    586579      template <typename CMap>
    587580      UEdgeMap& operator=(const CMap& cmap) {
    588         checkConcept<concept::ReadMap<UEdge, _Value>, CMap>();
    589         const typename Parent::Graph* graph = Parent::getGraph();
    590         UEdge it;
    591         for (graph->first(it); it != INVALID; graph->next(it)) {
    592           Parent::set(it, cmap[it]);
    593         }
     581        Parent::operator=(cmap);
    594582        return *this;
    595583      }
     584
    596585    };
    597586
Note: See TracChangeset for help on using the changeset viewer.