bool map problems solved.
authoralpar
Sat, 20 Mar 2004 16:07:19 +0000
changeset 215b3c4e6646f7f
parent 214 44f01e580f16
child 216 40fcfa5bfc32
bool map problems solved.
(now operator[] gives back 'std::vector<T>::reference' rather that 'T&')
src/work/alpar/smart_graph.h
     1.1 --- a/src/work/alpar/smart_graph.h	Sat Mar 20 13:48:04 2004 +0000
     1.2 +++ b/src/work/alpar/smart_graph.h	Sat Mar 20 16:07:19 2004 +0000
     1.3 @@ -371,12 +371,17 @@
     1.4  	if(k.n>=int(container.size())) container.resize(k.n+1);
     1.5        }
     1.6  
     1.7 -      void erase(const Node k) { }
     1.8 +      void erase(const Node) { }
     1.9        
    1.10        void set(Node n, T a) { container[n.n]=a; }
    1.11        //T get(Node n) const { return container[n.n]; }
    1.12 -      T& operator[](Node n) { return container[n.n]; }
    1.13 -      const T& operator[](Node n) const { return container[n.n]; }
    1.14 +      //Hajjaj:
    1.15 +      //T& operator[](Node n) { return container[n.n]; }
    1.16 +      typename std::vector<T>::reference
    1.17 +      operator[](Node n) { return container[n.n]; }
    1.18 +      //const T& operator[](Node n) const { return container[n.n]; }
    1.19 +      typename std::vector<T>::const_reference 
    1.20 +      operator[](Node n) const { return container[n.n]; }
    1.21  
    1.22        ///\warning There is no safety check at all!
    1.23        ///Using operator = between maps attached to different graph may
    1.24 @@ -458,12 +463,14 @@
    1.25        {
    1.26  	if(k.n>=int(container.size())) container.resize(k.n+1);
    1.27        }
    1.28 -      void erase(const Edge k) { }
    1.29 +      void erase(const Edge) { }
    1.30        
    1.31        void set(Edge n, T a) { container[n.n]=a; }
    1.32        //T get(Edge n) const { return container[n.n]; }
    1.33 -      T& operator[](Edge n) { return container[n.n]; }
    1.34 -      const T& operator[](Edge n) const { return container[n.n]; }
    1.35 +      typename std::vector<T>::reference
    1.36 +      operator[](Edge n) { return container[n.n]; }
    1.37 +      typename std::vector<T>::const_reference
    1.38 +      operator[](Edge n) const { return container[n.n]; }
    1.39  
    1.40        ///\warning There is no safety check at all!
    1.41        ///Using operator = between maps attached to different graph may
    1.42 @@ -604,8 +611,10 @@
    1.43        
    1.44        void set(Edge n, T a) { container[n.idref()/2]=a; }
    1.45        //T get(Edge n) const { return container[n.idref()/2]; }
    1.46 -      T& operator[](Edge n) { return container[n.idref()/2]; }
    1.47 -      const T& operator[](Edge n) const { return container[n.idref()/2]; }
    1.48 +      typename std::vector<T>::reference
    1.49 +      operator[](Edge n) { return container[n.idref()/2]; }
    1.50 +      typename std::vector<T>::const_reference
    1.51 +      operator[](Edge n) const { return container[n.idref()/2]; }
    1.52  
    1.53        ///\warning There is no safety check at all!
    1.54        ///Using operator = between maps attached to different graph may