template<typename T, typename HASH = DefaultCompare, typename ENTRY_HANDLER = HashMapKeyValuePair, typename ALLOCATOR = DefaultAllocator, HASHMAP_MODE MODE = HASHMAP_MODE::DEFAULT, Int INITIAL_CAPACITY = 16, Int LOAD_FACTOR = (MODE == HASHMAP_MODE::SYNCHRONIZED) ? 0 : 10, typename ENTRY_ALLOCATOR = ALLOCATOR>
class maxon::HashSet< T, HASH, ENTRY_HANDLER, ALLOCATOR, MODE, INITIAL_CAPACITY, LOAD_FACTOR, ENTRY_ALLOCATOR >
A HashSet is an implementation of a set based on hash codes for the elements. Internally, it is just a HashMap with no values. See HashMap for the details of hash code computation, load factors, performance etc.
This example shows the basic usage of HashSet:
if (!
names.Insert(
"Alice"_s))
... allocation failed ...;
if (!
names.Insert(
"Bob"_s, added))
... allocation failed ...;
if (added)
... "Bob" didn't exist before in names ...;
if (names.Contains("Cindy"_s))
... "Cindy" is in the set ...;
names.Erase("Bob"_s);
PyObject PyObject * names
Definition: code.h:159
maxon::Bool Bool
Definition: ge_sys_math.h:55
To iterate over the entries of a HashSet, use Iterator, ConstIterator or a ranged-based for loop:
{
}
{
}
Py_ssize_t i
Definition: abstract.h:645
Definition: c4d_string.h:39
typename Super::ConstKeyIterator ConstIterator
Definition: hashmap.h:3168
const Py_UNICODE size_t n
Definition: unicodeobject.h:1184
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
- Template Parameters
-
- See also
- HashMap
-
$ref sets
|
| HashSet (const ALLOCATOR &alloc) |
|
| HashSet ()=default |
|
| HashSet (HashSet &&src) |
|
| MAXON_OPERATOR_MOVE_ASSIGNMENT (HashSet) |
|
HashInt | GetHashCode () const |
|
UniqueHash | GetUniqueHashCode () const |
|
MapType & | GetMap () |
|
const MapType & | GetMap () const |
|
Bool | Contains (typename ByValueParam< T >::type value) const |
|
template<typename KEY , typename KEYHASH > |
Bool | Contains (const KEY &key) const |
|
void | Insert () const |
|
ResultRef< typename Super::Entry > | Insert (const T &value, Bool &added=BoolLValue()) |
|
ResultRef< typename Super::Entry > | Insert (T &&value, Bool &added=BoolLValue()) |
|
ResultRef< const T > | InsertKey (const T &value, Bool &added=BoolLValue()) |
|
ResultRef< const T > | InsertKey (T &&value, Bool &added=BoolLValue()) |
|
template<typename KEYHASH = HASH, typename KEY , typename LAMBDA > |
Result< Entry * > | InsertLambda (KEY &&key, LAMBDA &&lambda) |
|
ResultOk< Bool > | Erase (const T &value) |
|
ResultOk< void > | Erase (const Entry *entry) |
|
ConstIterator | Begin () const |
|
ConstIterator | End () const |
|
Iterator | Begin () |
|
Iterator | End () |
|
Iterator | Erase (const Iterator &it) |
|
template<typename KEYHASH = HASH, typename KEY > |
Entry * | Find (const KEY &key) |
|
template<typename KEYHASH = HASH, typename KEY > |
const Entry * | Find (const KEY &key) const |
|
ResultRef< Entry > | InsertEntry (const K &key, Bool &created=BoolLValue()) |
|
ResultRef< Entry > | InsertEntry (K &&key, Bool &created=BoolLValue()) |
|
template<typename KEYHASH = HASH, typename KEY > |
ResultRef< Entry > | InsertEntry (KEY &&key, Bool &created=BoolLValue()) |
|
template<typename KEYHASH = HASH, typename KEY , typename C > |
Result< Entry * > | InsertCtor (KEY &&key, C &&constructor, Bool &created=BoolLValue()) |
|
Int | GetCount () const |
|
Int | GetOperationCountForSearch () const |
|
ResultMem | SetCapacityHint (Int capacity, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) |
|
ResultMem | ResizeTable (Int capacity) |
|
void | Reset () |
|
void | Flush () |
|
template<typename SET > |
Result< void > | IntersectImpl (SET &&set, OverloadRank0) |
|
Int | GetMemorySize () const |
|
MAXON_ATTRIBUTE_FORCE_INLINE | SetBase (ARGS &&... args) |
|
SetImpl< HashSet< T, DefaultCompare, HashMapKeyValuePair, DefaultAllocator, HASHMAP_MODE::DEFAULT, 16,(HASHMAP_MODE::DEFAULT==HASHMAP_MODE::SYNCHRONIZED) ? 0 :10, DefaultAllocator > & > | ToSet () |
|
SetImpl< const HashSet< T, DefaultCompare, HashMapKeyValuePair, DefaultAllocator, HASHMAP_MODE::DEFAULT, 16,(HASHMAP_MODE::DEFAULT==HASHMAP_MODE::SYNCHRONIZED) ? 0 :10, DefaultAllocator > & > | ToSet () const |
|
MAXON_ATTRIBUTE_FORCE_INLINE | operator SetImpl< HashSet< T, DefaultCompare, HashMapKeyValuePair, DefaultAllocator, HASHMAP_MODE::DEFAULT, 16,(HASHMAP_MODE::DEFAULT==HASHMAP_MODE::SYNCHRONIZED) ? 0 :10, DefaultAllocator > & > () |
|
MAXON_ATTRIBUTE_FORCE_INLINE | operator SetImpl< const HashSet< T, DefaultCompare, HashMapKeyValuePair, DefaultAllocator, HASHMAP_MODE::DEFAULT, 16,(HASHMAP_MODE::DEFAULT==HASHMAP_MODE::SYNCHRONIZED) ? 0 :10, DefaultAllocator > & > () const |
|
template<typename... ARGS> |
MAXON_ATTRIBUTE_FORCE_INLINE | SetBase0 (ARGS &&... args) |
|
MAXON_ATTRIBUTE_FORCE_INLINE ResultRef< const VALUETYPE > | Append (typename ByValueParam< VALUETYPE >::type v) |
|
template<typename COLLECTION2 > |
Bool | ContainsAllImpl (COLLECTION2 &&other, OverloadRank0) const |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | Add (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | AppendAll (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | CopyFrom (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::FIT_TO_SIZE) |
|
template<typename COLLECTION2 > |
Result< void > | SubtractImpl (COLLECTION2 &&other, OverloadRank0) |
|
template<typename COLLECTION2 , typename COMPARE > |
Bool | IsEqualImpl (const COLLECTION2 &other, COMPARE &&cmp, OverloadRank0) const |
|
HashInt | GetHashCode () const |
|
UniqueHash | GetUniqueHashCode () const |
|
template<typename... ARGS> |
MAXON_ATTRIBUTE_FORCE_INLINE | Collection (ARGS &&... args) |
|
ResultOk< void > | VariadicAppend () |
|
template<typename V , typename... VALUES> |
Result< void > | VariadicAppend (V &&value, VALUES &&... rest) |
|
| operator ValueReceiver< const VALUETYPE & > () |
|
| operator ValueReceiver< VALUETYPE && > () |
|
| operator ValueReceiver< typename std::conditional< STD_IS_REPLACEMENT (scalar, VALUETYPE) |
|
DummyParamType & | type () |
|
template<typename FN > |
Result< Bool > | ForEach (FN &&callback) const |
|
template<typename FN > |
Result< Bool > | ForEach (FN &&callback) |
|
template<typename H = COLLECTION> |
H::Iterator | Find (typename ByValueParam< VALUETYPE >::type v) |
|
template<typename H = COLLECTION> |
H::ConstIterator | Find (typename ByValueParam< VALUETYPE >::type v) const |
|
Int | FindIndex (typename ByValueParam< VALUETYPE >::type v) const |
|
MAXON_ATTRIBUTE_FORCE_INLINE Bool | Contains (typename ByValueParam< VALUETYPE >::type v) const |
|
template<typename... ARGS> |
MAXON_ATTRIBUTE_FORCE_INLINE | BaseCollection (ARGS &&... args) |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value, Bool >::type | operator== (const COLLECTION2 &other) const |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value, Bool >::type | operator!= (const COLLECTION2 &other) const |
|
template<typename COMPARE = EqualityCompare, typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE std::enable_if< maxon::IsCollection< COLLECTION2 >::value &&!STD_IS_REPLACEMENT(same, typename std::decay< COMPARE >::type, EQUALITY), Bool >::type | IsEqual (const COLLECTION2 &other, COMPARE &&cmp=COMPARE()) const |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | AppendAll (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY) |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | CopyFrom (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags=COLLECTION_RESIZE_FLAGS::FIT_TO_SIZE) |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | Subtract (COLLECTION2 &&other) |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | Intersect (const COLLECTION2 &other) |
|
template<typename COLLECTION2 > |
Bool | Intersects (const COLLECTION2 &other) const |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE Result< void > | CopyFromImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, OverloadRank0) |
|
template<typename COLLECTION2 > |
Result< void > | AppendAllImpl (COLLECTION2 &&other, COLLECTION_RESIZE_FLAGS resizeFlags, Bool overwrite, OverloadRank0) |
|
template<typename COLLECTION2 > |
Result< void > | IntersectImpl (COLLECTION2 &&other, OverloadRank0) |
|
MAXON_ATTRIBUTE_FORCE_INLINE Bool | IsEmpty () const |
|
MAXON_ATTRIBUTE_FORCE_INLINE Bool | IsPopulated () const |
|
String | ToString (const FormatStatement *formatStatement=nullptr) const |
|
template<typename COLLECTION2 > |
MAXON_ATTRIBUTE_FORCE_INLINE Bool | ContainsAll (COLLECTION2 &&other) const |
|
template<typename COLLECTION2 > |
Bool | ContainsAllImpl (COLLECTION2 &&other, OverloadRank0) const |
|