aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/set.h
blob: d7c6afb8268478f347cea3ae08be0eaaf985da59 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
 
#include "fwd.h"

#include <util/str_stl.h>
#include <util/memory/alloc.h> 
 
#include <initializer_list>
#include <memory>
#include <set> 
 
template <class K, class L, class A>
class TSet: public std::set<K, L, TReboundAllocator<A, K>> {
public:
    using TBase = std::set<K, L, TReboundAllocator<A, K>>;
    using TBase::TBase;
 
    inline explicit operator bool() const noexcept {
        return !this->empty();
    }

    template <class TheKey>
    inline bool contains(const TheKey& key) const {
        return this->find(key) != this->end();
    }
}; 
 
template <class K, class L, class A>
class TMultiSet: public std::multiset<K, L, TReboundAllocator<A, K>> {
public:
    using TBase = std::multiset<K, L, TReboundAllocator<A, K>>;
    using TBase::TBase;
 
    inline explicit operator bool() const noexcept {
        return !this->empty();
    }

    template <class TheKey>
    inline bool contains(const TheKey& key) const {
        return this->find(key) != this->end();
    }
};