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

#include "array.h"

namespace vespalib {

template <typename T>
bool Array<T>::operator ==(const Array & rhs) const noexcept
{
    bool retval(size() == rhs.size());
    for (size_t i(0); retval && (i < _sz); i++) {
        if ( ! (*array(i) == rhs[i]) ) {
            retval = false;
        }
    }
    return retval;
}

template <typename T>
bool Array<T>::operator != (const Array & rhs) const noexcept {
    return !(*this == rhs);
}

}