src/work/alpar/rw_nonref_map.cc
changeset 736 ba76a7f56b23
parent 342 c98125b3f47c
child 921 818510fa3d99
equal deleted inserted replaced
0:c3d56e14401d 1:93ce1f4a8d18
    41 public:
    41 public:
    42   CinCoutMap(Graph &_G) : G(_G) { }
    42   CinCoutMap(Graph &_G) : G(_G) { }
    43   RefType operator[] (Edge e) const { return RefType(G,e);}  
    43   RefType operator[] (Edge e) const { return RefType(G,e);}  
    44 };
    44 };
    45 
    45 
       
    46 template<class K,class T>
       
    47 class NullMap
       
    48 {
       
    49 public:
       
    50   typedef K KeyType;
       
    51   typedef T ValueType;
       
    52   
       
    53   class RefType 
       
    54   {
       
    55     ValueType val;
       
    56   public:
       
    57     RefType(ValueType v) : val(v) { }   
       
    58     operator ValueType() const { return val; }
       
    59     ValueType operator = (ValueType v) const { return val; }
       
    60   };
       
    61   
       
    62 private:
       
    63   ValueType val;
       
    64 public:
       
    65   NullMap(ValueType v) : val(v) { }
       
    66   RefType operator[] (KeyType e) const { return RefType(v);}  
       
    67 };
       
    68 
    46 int main()
    69 int main()
    47 {
    70 {
    48   typedef SmartGraph Graph;
    71   typedef SmartGraph Graph;
    49   typedef Graph::NodeIt NodeIt;
    72   typedef Graph::NodeIt NodeIt;
    50   typedef Graph::OutEdgeIt OutEdgeIt;
    73   typedef Graph::OutEdgeIt OutEdgeIt;