aboutsummaryrefslogblamecommitdiffstats
path: root/util/generic/set.h
blob: 4c437ca26f9cef5468e3624965d78f136c821d45 (plain) (tree)
1
2
3
4
5
6
7
8
9
            
 

                         
                              
                           
                 
              
                                    
                                                            
       
                                                          
                       
 


                                                    
                           

                                                   
  
                                    
                                                                      
       
                                                               
                       
 

                                                    



                                                   
  
#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();
    }
};