COIN-OR::LEMON - Graph Library

Changeset 798:6d1abeb62dd3 in lemon-0.x for src/hugo/vector_map_factory.h


Ignore:
Timestamp:
09/03/04 17:11:17 (16 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1092
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hugo/vector_map_factory.h

    r786 r798  
    1818  /** The VectorMapFactory template class is a factory class
    1919   *  to create maps for the edge and nodes. This map factory
    20    *  use the std::vector to implement the container function.
     20   *  uses the std::vector to implement the container function.
    2121   *
    2222   *  The template parameter is the MapRegistry that the maps
     
    4343    template <typename V>
    4444    class Map : public MapBase {
     45
     46      typedef std::vector<V> Container;
     47
    4548    public:
     49
     50      /// The value type of the map.
     51      typedef V ValueType;
    4652
    4753      /// The value type of the map.
    4854      typedef V Value;
    49 
    50       typedef std::vector<Value> Container;     
     55      /// The reference type of the map;
     56      typedef typename Container::reference Reference;
     57      /// The pointer type of the map;
     58      typedef typename Container::pointer Pointer;
     59
     60      /// The const value type of the map.
     61      typedef const Value ConstValue;
     62      /// The const reference type of the map;
     63      typedef typename Container::const_reference ConstReference;
     64      /// The pointer type of the map;
     65      typedef typename Container::const_pointer ConstPointer;
    5166
    5267      /** Default constructor for the map.
     
    6580        for (KeyIt it(*getGraph()); it != INVALID; ++it) {
    6681          int id = getGraph()->id(it);
    67           if (id >= container.size()) {
     82          if (id >= (int)container.size()) {
    6883            container.resize(id + 1);
    6984          }
     
    7893          for (KeyIt it(*getGraph()); it != INVALID; ++it) {
    7994            int id = getGraph()->id(it);
    80             if (id >= container.size()) {
     95            if (id >= (int)container.size()) {
    8196              container.resize(id + 1);
    8297            }
     
    96111          for (KeyIt it(*getGraph()); it != INVALID; ++it) {
    97112            int id = getGraph()->id(it);
    98             if (id >= container.size()) {
     113            if (id >= (int)container.size()) {
    99114              container.resize(id + 1);
    100115            }
     
    102117          }
    103118        }
     119        return *this;
    104120      }
    105121
     
    113129       * actual keys of the graph.
    114130       */
     131<<<<<<< .mine
     132      Reference operator[](const Key& key) {
     133=======
    115134      typename Container::reference operator[](const KeyType& key) {
     135>>>>>>> .r1091
    116136        int id = getGraph()->id(key);
    117137        return container[id];
     
    122142       * actual keys of the graph.
    123143       */
     144<<<<<<< .mine
     145      ConstReference operator[](const Key& key) const {
     146=======
    124147      typename Container::const_reference operator[](const KeyType& key) const {
     148>>>>>>> .r1091
    125149        int id = getGraph()->id(key);
    126150        return container[id];
     
    139163      void add(const KeyType& key) {
    140164        int id = getGraph()->id(key);
    141         if (id >= container.size()) {
     165        if (id >= (int)container.size()) {
    142166          container.resize(id + 1);
    143167        }
     
    174198
    175199        typedef extended_pair<const KeyType&, const KeyType&,
    176                               Value&, Value&> Reference;
     200                              Map::Reference, Map::Reference> Reference;
    177201
    178202        /** Dereference operator for map.
     
    264288     
    265289        typedef extended_pair<const KeyType&, const KeyType&,
    266           const Value&, const Value&> Reference;
     290          Map::ConstReference, Map::ConstReference> Reference;
    267291
    268292        /** Dereference operator for map.
Note: See TracChangeset for help on using the changeset viewer.