66 template <typename CMap> Map& operator=(const CMap& copy) { |
66 template <typename CMap> Map& operator=(const CMap& copy) { |
67 MapImpl::operator=(copy); |
67 MapImpl::operator=(copy); |
68 return *this; |
68 return *this; |
69 } |
69 } |
70 |
70 |
71 Value& operator[](const Key& key) { |
71 Value& operator[](const KeyType& key) { |
72 int id = MapBase::getGraph()->id(key); |
72 int id = MapBase::getGraph()->id(key); |
73 return MapImpl::operator[](id >> 1); |
73 return MapImpl::operator[](id >> 1); |
74 } |
74 } |
75 |
75 |
76 const Value& operator[](const Key& key) const { |
76 const Value& operator[](const KeyType& key) const { |
77 int id = MapBase::getGraph()->id(key); |
77 int id = MapBase::getGraph()->id(key); |
78 return MapImpl::operator[](id >> 1); |
78 return MapImpl::operator[](id >> 1); |
79 } |
79 } |
80 |
80 |
81 const Value& get(const Key& key) const { |
81 const Value& get(const KeyType& key) const { |
82 int id = MapBase::getGraph()->id(key); |
82 int id = MapBase::getGraph()->id(key); |
83 return MapImpl::operator[](id >> 1); |
83 return MapImpl::operator[](id >> 1); |
84 } |
84 } |
85 |
85 |
86 void set(const Key& key, const Value& val) { |
86 void set(const KeyType& key, const Value& val) { |
87 int id = MapBase::getGraph()->id(key); |
87 int id = MapBase::getGraph()->id(key); |
88 MapImpl::operator[](id >> 1) = val; |
88 MapImpl::operator[](id >> 1) = val; |
89 } |
89 } |
90 |
90 |
91 void add(const Key& key) { |
91 void add(const KeyType& key) { |
92 int id = MapBase::getGraph()->id(key); |
92 int id = MapBase::getGraph()->id(key); |
93 if (id & 1) return; |
93 if (id & 1) return; |
94 MapImpl::add(key); |
94 MapImpl::add(key); |
95 } |
95 } |
96 |
96 |
97 void erase(const Key& key) { |
97 void erase(const KeyType& key) { |
98 int id = MapBase::getGraph()->id(key); |
98 int id = MapBase::getGraph()->id(key); |
99 if (id & 1) return; |
99 if (id & 1) return; |
100 MapImpl::add(key); |
100 MapImpl::add(key); |
101 } |
101 } |
102 |
102 |