COIN-OR::LEMON - Graph Library

Changeset 891:74589d20dbc3 in lemon-0.x for src/hugo/vector_map.h


Ignore:
Timestamp:
09/21/04 00:57:48 (20 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1199
Message:

template<typename CMap> Map(const CMap&) like constructors and
assigns are removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hugo/vector_map.h

    r844 r891  
    3333  template <typename MapRegistry, typename Value>
    3434  class VectorMap : public MapRegistry::MapBase {
     35    template <typename MR, typename T> friend class VectorMap;
    3536  public:
    3637               
     
    8384      : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1, v) {}
    8485
    85     /** Constructor to copy a map of an other map type.
    86      */
    87     template <typename CMap> VectorMap(const CMap& copy) : MapBase(copy) {
    88       if (MapBase::getGraph()) {
    89         container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1);
    90         for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
    91           set(it, copy[it]);
    92         }
     86    /** Assign operator to copy a map of an other map type.
     87     */
     88    template <typename TT>
     89    VectorMap(const VectorMap<MapRegistry, TT>& c)
     90      : MapBase(c), container(c.container.size()) {
     91      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
     92        int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
     93        container[id] = c.container[id];
    9394      }
    9495    }
    9596
    96     /** Assign operator to copy a map an other map type.
    97      */
    98     template <typename CMap> VectorMap& operator=(const CMap& copy) {
    99       container.clear();
    100       this->MapBase::operator=(copy);
    101       if (MapBase::getGraph()) {
    102         container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1);
    103         for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
    104           set(it, copy[it]);
    105         }
     97    /** Assign operator to copy a map of an other map type.
     98     */
     99    template <typename TT>
     100    VectorMap& operator=(const VectorMap<MapRegistry, TT>& c) {
     101      container.resize(c.container.size());
     102      MapBase::operator=(c);
     103      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
     104        int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
     105        container[id] = c.container[id];
    106106      }
    107107      return *this;
    108108    }
    109 
    110     /** The destructor of the map.
    111      */
    112     virtual ~VectorMap() {
    113     }
    114                
    115109    /**
    116110     * The subscript operator. The map can be subscripted by the
Note: See TracChangeset for help on using the changeset viewer.