| 390 | |
| 391 | template <typename K, typename V> |
| 392 | Map<K, V> *Map<K, V>::intersect_with(Map<K, V> *that) { |
| 393 | Map<K, V> *result = new Map<K, V>(_cmp, _hash); |
| 394 | for (Each it(this); it; it++) { |
| 395 | if (that->contains(it.key())) |
| 396 | result->add(it.key(), it.value()); |
| 397 | } |
| 398 | return result; |
| 399 | } |
| 400 | |
| 401 | template <typename K, typename V> |
| 402 | Map<K, V> *Map<K, V>::intersect_in_place(Map<K, V> *that) { |