COIN-OR::LEMON - Graph Library

Changeset 2386:81b47fc5c444 in lemon-0.x for lemon/bellman_ford.h


Ignore:
Timestamp:
03/02/07 19:04:28 (17 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3217
Message:

Hard Warning checking

  • based on the remark of the ZIB user
  • we do not use -Winline
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/bellman_ford.h

    r2376 r2386  
    437437    /// paths.
    438438    bool processNextRound() {
    439       for (int i = 0; i < (int)_process.size(); ++i) {
     439      for (int i = 0; i < int(_process.size()); ++i) {
    440440        _mask->set(_process[i], false);
    441441      }
    442442      std::vector<Node> nextProcess;
    443443      std::vector<Value> values(_process.size());
    444       for (int i = 0; i < (int)_process.size(); ++i) {
     444      for (int i = 0; i < int(_process.size()); ++i) {
    445445        values[i] = (*_dist)[_process[i]];
    446446      }
    447       for (int i = 0; i < (int)_process.size(); ++i) {
     447      for (int i = 0; i < int(_process.size()); ++i) {
    448448        for (OutEdgeIt it(*graph, _process[i]); it != INVALID; ++it) {
    449449          Node target = graph->target(it);
     
    473473    /// \return %True when the algorithm have not found more shorter paths.
    474474    bool processNextWeakRound() {
    475       for (int i = 0; i < (int)_process.size(); ++i) {
     475      for (int i = 0; i < int(_process.size()); ++i) {
    476476        _mask->set(_process[i], false);
    477477      }
    478478      std::vector<Node> nextProcess;
    479       for (int i = 0; i < (int)_process.size(); ++i) {
     479      for (int i = 0; i < int(_process.size()); ++i) {
    480480        for (OutEdgeIt it(*graph, _process[i]); it != INVALID; ++it) {
    481481          Node target = graph->target(it);
     
    646646
    647647      bool operator==(const ActiveIt& it) const {
    648         return (Node)(*this) == (Node)it;
     648        return static_cast<Node>(*this) == static_cast<Node>(it);
    649649      }
    650650      bool operator!=(const ActiveIt& it) const {
    651         return (Node)(*this) != (Node)it;
     651        return static_cast<Node>(*this) != static_cast<Node>(it);
    652652      }
    653653      bool operator<(const ActiveIt& it) const {
    654         return (Node)(*this) < (Node)it;
     654        return static_cast<Node>(*this) < static_cast<Node>(it);
    655655      }
    656656     
     
    866866                          const _LengthMap& length,
    867867                          Node source = INVALID) :
    868       _graph((void *)&graph), _length((void *)&length), _pred(0),
    869       _dist(0), _source(source) {}
     868      _graph(reinterpret_cast<void*>(const_cast<_Graph*>(&graph))),
     869      _length(reinterpret_cast<void*>(const_cast<_LengthMap*>(&length))),
     870      _pred(0), _dist(0), _source(source) {}
    870871
    871872  };
     
    924925    /// These parameters will be the default values for the traits class.
    925926    BellmanFordWizard(const Graph& graph, const LengthMap& length,
    926                       Node source = INVALID)
    927       : _Traits(graph, length, source) {}
     927                      Node src = INVALID)
     928      : _Traits(graph, length, src) {}
    928929
    929930    /// \brief Copy constructor
     
    939940      if(Base::_source == INVALID) throw UninitializedParameter();
    940941      BellmanFord<Graph,LengthMap,_Traits>
    941         bf(*(Graph*)Base::_graph, *(LengthMap*)Base::_length);
    942       if (Base::_pred) bf.predMap(*(PredMap*)Base::_pred);
    943       if (Base::_dist) bf.distMap(*(DistMap*)Base::_dist);
     942        bf(*reinterpret_cast<const Graph*>(Base::_graph),
     943           *reinterpret_cast<const LengthMap*>(Base::_length));
     944      if (Base::_pred) bf.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
     945      if (Base::_dist) bf.distMap(*reinterpret_cast<DistMap*>(Base::_dist));
    944946      bf.run(Base::_source);
    945947    }
     
    949951    /// Runs BellmanFord algorithm from the given node.
    950952    /// \param source is the given source.
    951     void run(Node source) {
    952       Base::_source = source;
     953    void run(Node src) {
     954      Base::_source = src;
    953955      run();
    954956    }
     
    970972    BellmanFordWizard<DefPredMapBase<T> > predMap(const T &t)
    971973    {
    972       Base::_pred=(void *)&t;
     974      Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t));
    973975      return BellmanFordWizard<DefPredMapBase<T> >(*this);
    974976    }
     
    989991    template<class T>
    990992    BellmanFordWizard<DefDistMapBase<T> > distMap(const T &t) {
    991       Base::_dist=(void *)&t;
     993      Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t));
    992994      return BellmanFordWizard<DefDistMapBase<T> >(*this);
    993995    }
     
    10141016    /// Sets the source node, from which the BellmanFord algorithm runs.
    10151017    /// \param source is the source node.
    1016     BellmanFordWizard<_Traits>& source(Node source) {
    1017       Base::_source = source;
     1018    BellmanFordWizard<_Traits>& source(Node src) {
     1019      Base::_source = src;
    10181020      return *this;
    10191021    }
Note: See TracChangeset for help on using the changeset viewer.