COIN-OR::LEMON - Graph Library

Changeset 215:b3c4e6646f7f in lemon-0.x for src


Ignore:
Timestamp:
03/20/04 17:07:19 (16 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@310
Message:

bool map problems solved.
(now operator[] gives back 'std::vector<T>::reference' rather that 'T&')

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/alpar/smart_graph.h

    r209 r215  
    372372      }
    373373
    374       void erase(const Node k) { }
     374      void erase(const Node) { }
    375375     
    376376      void set(Node n, T a) { container[n.n]=a; }
    377377      //T get(Node n) const { return container[n.n]; }
    378       T& operator[](Node n) { return container[n.n]; }
    379       const T& operator[](Node n) const { return container[n.n]; }
     378      //Hajjaj:
     379      //T& operator[](Node n) { return container[n.n]; }
     380      typename std::vector<T>::reference
     381      operator[](Node n) { return container[n.n]; }
     382      //const T& operator[](Node n) const { return container[n.n]; }
     383      typename std::vector<T>::const_reference
     384      operator[](Node n) const { return container[n.n]; }
    380385
    381386      ///\warning There is no safety check at all!
     
    459464        if(k.n>=int(container.size())) container.resize(k.n+1);
    460465      }
    461       void erase(const Edge k) { }
     466      void erase(const Edge) { }
    462467     
    463468      void set(Edge n, T a) { container[n.n]=a; }
    464469      //T get(Edge n) const { return container[n.n]; }
    465       T& operator[](Edge n) { return container[n.n]; }
    466       const T& operator[](Edge n) const { return container[n.n]; }
     470      typename std::vector<T>::reference
     471      operator[](Edge n) { return container[n.n]; }
     472      typename std::vector<T>::const_reference
     473      operator[](Edge n) const { return container[n.n]; }
    467474
    468475      ///\warning There is no safety check at all!
     
    605612      void set(Edge n, T a) { container[n.idref()/2]=a; }
    606613      //T get(Edge n) const { return container[n.idref()/2]; }
    607       T& operator[](Edge n) { return container[n.idref()/2]; }
    608       const T& operator[](Edge n) const { return container[n.idref()/2]; }
     614      typename std::vector<T>::reference
     615      operator[](Edge n) { return container[n.idref()/2]; }
     616      typename std::vector<T>::const_reference
     617      operator[](Edge n) const { return container[n.idref()/2]; }
    609618
    610619      ///\warning There is no safety check at all!
Note: See TracChangeset for help on using the changeset viewer.