openMSX
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
hash_set< Value, Extractor, Hasher, Equal > Class Template Reference

#include <hash_set.hh>

Inheritance diagram for hash_set< Value, Extractor, Hasher, Equal >:
Inheritance graph
[legend]
Collaboration diagram for hash_set< Value, Extractor, Hasher, Equal >:
Collaboration graph
[legend]

Classes

class  Iter
 

Public Types

using value_type = Value
 
using iterator = Iter< hash_set, Value >
 
using const_iterator = Iter< const hash_set, const Value >
 

Public Member Functions

 hash_set (unsigned initialSize=0, Extractor extract_=Extractor(), Hasher hasher_=Hasher(), Equal equal_=Equal())
 
 hash_set (const hash_set &source)
 
 hash_set (hash_set &&source) noexcept
 
 hash_set (std::initializer_list< Value > args)
 
 ~hash_set ()
 
hash_setoperator= (const hash_set &source)
 
hash_setoperator= (hash_set &&source) noexcept
 
template<typename K >
bool contains (const K &key) const
 
template<typename V >
std::pair< iterator, bool > insert (V &&value)
 
template<typename V >
std::pair< iterator, bool > insert_noCapacityCheck (V &&value)
 
template<typename V >
iterator insert_noDuplicateCheck (V &&value)
 
template<typename V >
iterator insert_noCapacityCheck_noDuplicateCheck (V &&value)
 
template<typename... Args>
std::pair< iterator, bool > emplace (Args &&... args)
 
template<typename... Args>
std::pair< iterator, bool > emplace_noCapacityCheck (Args &&... args)
 
template<typename... Args>
iterator emplace_noDuplicateCheck (Args &&... args)
 
template<typename... Args>
iterator emplace_noCapacityCheck_noDuplicateCheck (Args &&... args)
 
template<typename K >
bool erase (const K &key)
 
void erase (iterator it)
 
bool empty () const
 
unsigned size () const
 
void clear ()
 
template<typename K >
iterator find (const K &key)
 
template<typename K >
const_iterator find (const K &key) const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
unsigned capacity () const
 
void reserve (unsigned count)
 

Protected Types

using PoolIndex = hash_set_impl::PoolIndex
 

Protected Member Functions

template<bool CHECK_CAPACITY, bool CHECK_DUPLICATE, typename V >
std::pair< iterator, bool > insert_impl (V &&value)
 
template<bool CHECK_CAPACITY, bool CHECK_DUPLICATE, typename... Args>
std::pair< iterator, bool > emplace_impl (Args &&... args)
 
void grow ()
 
void rehash (unsigned oldCount)
 
template<typename K >
PoolIndex locateElement (const K &key) const
 

Static Protected Member Functions

static unsigned nextPowerOf2 (unsigned x)
 

Protected Attributes

PoolIndextable = nullptr
 
hash_set_impl::Pool< Value > pool
 
unsigned allocMask = unsigned(-1)
 
unsigned elemCount = 0
 
Extractor extract
 
Hasher hasher
 
Equal equal
 

Static Protected Attributes

static constexpr auto invalidIndex = hash_set_impl::invalidIndex
 

Friends

void swap (hash_set &x, hash_set &y) noexcept
 
auto begin (hash_set &s)
 
auto begin (const hash_set &s)
 
auto end (hash_set &s)
 
auto end (const hash_set &s)
 

Detailed Description

template<typename Value, typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
class hash_set< Value, Extractor, Hasher, Equal >

Definition at line 269 of file hash_set.hh.

Member Typedef Documentation

◆ const_iterator

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
using hash_set< Value, Extractor, Hasher, Equal >::const_iterator = Iter<const hash_set, const Value>

Definition at line 344 of file hash_set.hh.

◆ iterator

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
using hash_set< Value, Extractor, Hasher, Equal >::iterator = Iter< hash_set, Value>

Definition at line 343 of file hash_set.hh.

◆ PoolIndex

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
using hash_set< Value, Extractor, Hasher, Equal >::PoolIndex = hash_set_impl::PoolIndex
protected

Definition at line 272 of file hash_set.hh.

◆ value_type

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
using hash_set< Value, Extractor, Hasher, Equal >::value_type = Value

Definition at line 276 of file hash_set.hh.

Constructor & Destructor Documentation

◆ hash_set() [1/4]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
hash_set< Value, Extractor, Hasher, Equal >::hash_set ( unsigned  initialSize = 0,
Extractor  extract_ = Extractor(),
Hasher  hasher_ = Hasher(),
Equal  equal_ = Equal() 
)
inlineexplicit

◆ hash_set() [2/4]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
hash_set< Value, Extractor, Hasher, Equal >::hash_set ( const hash_set< Value, Extractor, Hasher, Equal > &  source)
inline

◆ hash_set() [3/4]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
hash_set< Value, Extractor, Hasher, Equal >::hash_set ( hash_set< Value, Extractor, Hasher, Equal > &&  source)
inlinenoexcept

Definition at line 372 of file hash_set.hh.

◆ hash_set() [4/4]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
hash_set< Value, Extractor, Hasher, Equal >::hash_set ( std::initializer_list< Value >  args)
inlineexplicit

◆ ~hash_set()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
hash_set< Value, Extractor, Hasher, Equal >::~hash_set ( )
inline

Member Function Documentation

◆ begin() [1/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
iterator hash_set< Value, Extractor, Hasher, Equal >::begin ( )
inline

◆ begin() [2/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
const_iterator hash_set< Value, Extractor, Hasher, Equal >::begin ( ) const
inline

◆ capacity()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
unsigned hash_set< Value, Extractor, Hasher, Equal >::capacity ( ) const
inline

◆ clear()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
void hash_set< Value, Extractor, Hasher, Equal >::clear ( )
inline

◆ contains()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename K >
bool hash_set< Value, Extractor, Hasher, Equal >::contains ( const K &  key) const
inline

◆ emplace()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename... Args>
std::pair< iterator, bool > hash_set< Value, Extractor, Hasher, Equal >::emplace ( Args &&...  args)
inline

Definition at line 462 of file hash_set.hh.

Referenced by openmsx::SettingsConfig::loadSetting().

◆ emplace_impl()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<bool CHECK_CAPACITY, bool CHECK_DUPLICATE, typename... Args>
std::pair< iterator, bool > hash_set< Value, Extractor, Hasher, Equal >::emplace_impl ( Args &&...  args)
inlineprotected

◆ emplace_noCapacityCheck()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename... Args>
std::pair< iterator, bool > hash_set< Value, Extractor, Hasher, Equal >::emplace_noCapacityCheck ( Args &&...  args)
inline

Definition at line 467 of file hash_set.hh.

◆ emplace_noCapacityCheck_noDuplicateCheck()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename... Args>
iterator hash_set< Value, Extractor, Hasher, Equal >::emplace_noCapacityCheck_noDuplicateCheck ( Args &&...  args)
inline

Definition at line 477 of file hash_set.hh.

◆ emplace_noDuplicateCheck()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename... Args>
iterator hash_set< Value, Extractor, Hasher, Equal >::emplace_noDuplicateCheck ( Args &&...  args)
inline

◆ empty()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
bool hash_set< Value, Extractor, Hasher, Equal >::empty ( ) const
inline

◆ end() [1/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
iterator hash_set< Value, Extractor, Hasher, Equal >::end ( )
inline

◆ end() [2/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
const_iterator hash_set< Value, Extractor, Hasher, Equal >::end ( ) const
inline

Definition at line 587 of file hash_set.hh.

◆ erase() [1/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename K >
bool hash_set< Value, Extractor, Hasher, Equal >::erase ( const K &  key)
inline

◆ erase() [2/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
void hash_set< Value, Extractor, Hasher, Equal >::erase ( iterator  it)
inline

◆ find() [1/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename K >
iterator hash_set< Value, Extractor, Hasher, Equal >::find ( const K &  key)
inline

◆ find() [2/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename K >
const_iterator hash_set< Value, Extractor, Hasher, Equal >::find ( const K &  key) const
inline

◆ grow()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
void hash_set< Value, Extractor, Hasher, Equal >::grow ( )
inlineprotected

◆ insert()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename V >
std::pair< iterator, bool > hash_set< Value, Extractor, Hasher, Equal >::insert ( V &&  value)
inline

Definition at line 441 of file hash_set.hh.

Referenced by hash_map< Key, Value, Hasher, Equal >::operator[]().

◆ insert_impl()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<bool CHECK_CAPACITY, bool CHECK_DUPLICATE, typename V >
std::pair< iterator, bool > hash_set< Value, Extractor, Hasher, Equal >::insert_impl ( V &&  value)
inlineprotected

◆ insert_noCapacityCheck()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename V >
std::pair< iterator, bool > hash_set< Value, Extractor, Hasher, Equal >::insert_noCapacityCheck ( V &&  value)
inline

Definition at line 446 of file hash_set.hh.

Referenced by hash_set< Value, Extractor, Hasher, Equal >::hash_set().

◆ insert_noCapacityCheck_noDuplicateCheck()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename V >
iterator hash_set< Value, Extractor, Hasher, Equal >::insert_noCapacityCheck_noDuplicateCheck ( V &&  value)
inline

◆ insert_noDuplicateCheck()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename V >
iterator hash_set< Value, Extractor, Hasher, Equal >::insert_noDuplicateCheck ( V &&  value)
inline

Definition at line 451 of file hash_set.hh.

◆ locateElement()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
template<typename K >
PoolIndex hash_set< Value, Extractor, Hasher, Equal >::locateElement ( const K &  key) const
inlineprotected

◆ nextPowerOf2()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
static unsigned hash_set< Value, Extractor, Hasher, Equal >::nextPowerOf2 ( unsigned  x)
inlinestaticprotected

Definition at line 642 of file hash_set.hh.

Referenced by hash_set< Value, Extractor, Hasher, Equal >::reserve().

◆ operator=() [1/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
hash_set & hash_set< Value, Extractor, Hasher, Equal >::operator= ( const hash_set< Value, Extractor, Hasher, Equal > &  source)
inline

◆ operator=() [2/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
hash_set & hash_set< Value, Extractor, Hasher, Equal >::operator= ( hash_set< Value, Extractor, Hasher, Equal > &&  source)
inlinenoexcept

◆ rehash()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
void hash_set< Value, Extractor, Hasher, Equal >::rehash ( unsigned  oldCount)
inlineprotected

◆ reserve()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
void hash_set< Value, Extractor, Hasher, Equal >::reserve ( unsigned  count)
inline

◆ size()

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
unsigned hash_set< Value, Extractor, Hasher, Equal >::size ( ) const
inline

Friends And Related Symbol Documentation

◆ begin [1/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
auto begin ( const hash_set< Value, Extractor, Hasher, Equal > &  s)
friend

Definition at line 635 of file hash_set.hh.

◆ begin [2/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
auto begin ( hash_set< Value, Extractor, Hasher, Equal > &  s)
friend

Definition at line 634 of file hash_set.hh.

◆ end [1/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
auto end ( const hash_set< Value, Extractor, Hasher, Equal > &  s)
friend

Definition at line 637 of file hash_set.hh.

◆ end [2/2]

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
auto end ( hash_set< Value, Extractor, Hasher, Equal > &  s)
friend

Definition at line 636 of file hash_set.hh.

◆ swap

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
void swap ( hash_set< Value, Extractor, Hasher, Equal > &  x,
hash_set< Value, Extractor, Hasher, Equal > &  y 
)
friend

Definition at line 622 of file hash_set.hh.

Member Data Documentation

◆ allocMask

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
unsigned hash_set< Value, Extractor, Hasher, Equal >::allocMask = unsigned(-1)
protected

◆ elemCount

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
unsigned hash_set< Value, Extractor, Hasher, Equal >::elemCount = 0
protected

◆ equal

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
Equal hash_set< Value, Extractor, Hasher, Equal >::equal
protected

◆ extract

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
Extractor hash_set< Value, Extractor, Hasher, Equal >::extract
protected

◆ hasher

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
Hasher hash_set< Value, Extractor, Hasher, Equal >::hasher
protected

◆ invalidIndex

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
constexpr auto hash_set< Value, Extractor, Hasher, Equal >::invalidIndex = hash_set_impl::invalidIndex
staticconstexprprotected

◆ pool

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
hash_set_impl::Pool<Value> hash_set< Value, Extractor, Hasher, Equal >::pool
protected

◆ table

template<typename Value , typename Extractor = std::identity, typename Hasher = std::hash<hash_set_impl::ExtractedType<Value, Extractor>>, typename Equal = std::equal_to<>>
PoolIndex* hash_set< Value, Extractor, Hasher, Equal >::table = nullptr
protected

The documentation for this class was generated from the following file: