aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/stllike/hash_map_equal.hpp
blob: 8b215566b6931e4b4227c73965c42aeadaa18d4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "hash_map.h"

namespace vespalib {

template <typename K, typename V, typename H, typename EQ, typename M>
bool
hash_map<K, V, H, EQ, M>::operator ==(const hash_map & rhs) const {
    bool identical(rhs.size() == size());
    if (identical) {
        for(const_iterator at(begin()), mat(end()); identical && at != mat; at++) {
            const_iterator bt = rhs.find(at->first);
            identical = (bt != rhs.end()) && (*at == *bt);
        }
    }
    return identical;
}

}