lemon/cost_scaling.h
changeset 886 7ef7a5fbb85d
parent 879 25804ef35064
child 887 072ec8120958
equal deleted inserted replaced
4:7dcc8e2f970d 5:fd6a223b2822
   203     typedef std::vector<LargeCost> LargeCostVector;
   203     typedef std::vector<LargeCost> LargeCostVector;
   204 
   204 
   205   private:
   205   private:
   206   
   206   
   207     template <typename KT, typename VT>
   207     template <typename KT, typename VT>
   208     class VectorMap {
   208     class StaticVectorMap {
   209     public:
   209     public:
   210       typedef KT Key;
   210       typedef KT Key;
   211       typedef VT Value;
   211       typedef VT Value;
   212       
   212       
   213       VectorMap(std::vector<Value>& v) : _v(v) {}
   213       StaticVectorMap(std::vector<Value>& v) : _v(v) {}
   214       
   214       
   215       const Value& operator[](const Key& key) const {
   215       const Value& operator[](const Key& key) const {
   216         return _v[StaticDigraph::id(key)];
   216         return _v[StaticDigraph::id(key)];
   217       }
   217       }
   218 
   218 
   226 
   226 
   227     private:
   227     private:
   228       std::vector<Value>& _v;
   228       std::vector<Value>& _v;
   229     };
   229     };
   230 
   230 
   231     typedef VectorMap<StaticDigraph::Node, LargeCost> LargeCostNodeMap;
   231     typedef StaticVectorMap<StaticDigraph::Node, LargeCost> LargeCostNodeMap;
   232     typedef VectorMap<StaticDigraph::Arc, LargeCost> LargeCostArcMap;
   232     typedef StaticVectorMap<StaticDigraph::Arc, LargeCost> LargeCostArcMap;
   233 
   233 
   234   private:
   234   private:
   235 
   235 
   236     // Data related to the underlying digraph
   236     // Data related to the underlying digraph
   237     const GR &_graph;
   237     const GR &_graph;