aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/set.h
blob: 43325e7bd5dfdf45f25578edb16e49c103eced54 (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();
    }
};