src/work/alpar/rw_nonref_map.cc
changeset 351 01fb9da7a363
parent 342 c98125b3f47c
child 921 818510fa3d99
     1.1 --- a/src/work/alpar/rw_nonref_map.cc	Sat Apr 17 19:34:43 2004 +0000
     1.2 +++ b/src/work/alpar/rw_nonref_map.cc	Sat Apr 17 19:54:04 2004 +0000
     1.3 @@ -43,6 +43,29 @@
     1.4    RefType operator[] (Edge e) const { return RefType(G,e);}  
     1.5  };
     1.6  
     1.7 +template<class K,class T>
     1.8 +class NullMap
     1.9 +{
    1.10 +public:
    1.11 +  typedef K KeyType;
    1.12 +  typedef T ValueType;
    1.13 +  
    1.14 +  class RefType 
    1.15 +  {
    1.16 +    ValueType val;
    1.17 +  public:
    1.18 +    RefType(ValueType v) : val(v) { }   
    1.19 +    operator ValueType() const { return val; }
    1.20 +    ValueType operator = (ValueType v) const { return val; }
    1.21 +  };
    1.22 +  
    1.23 +private:
    1.24 +  ValueType val;
    1.25 +public:
    1.26 +  NullMap(ValueType v) : val(v) { }
    1.27 +  RefType operator[] (KeyType e) const { return RefType(v);}  
    1.28 +};
    1.29 +
    1.30  int main()
    1.31  {
    1.32    typedef SmartGraph Graph;