aboutsummaryrefslogtreecommitdiffstats
path: root/src/3rdparty/masm/stubs/wtf/HashSet.h
blob: 741f448ff3ab80756932c115b0189cfa8dd2a789 (plain)
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
26
27
28
29
30
31
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef HASHSET_H
#define HASHSET_H

#include <QtCore/qset.h>

namespace WTF {

template<typename Key>
class HashSet final : public QSet<Key>
{
public:
    struct SetAddResult {
        bool isNewEntry;
    };
    SetAddResult add(const Key &k)
    {
        if (QSet<Key>::find(k) == QSet<Key>::constEnd()) {
            QSet<Key>::insert(k);
            return { true };
        }
        return { false };
    }
};

}

using WTF::HashSet;

#endif