A value of this type is returned with methods Extract, which allows removing an element from the hashtable, without deleting its allocated storage and destructing its custom value.
This handle allows writing access to the value of an extracted element. In combination with methods Insert(ElementHandle&) and InsertIfNotExistent(ElementHandle&), this supports changing parts of the element value, including the key-portion with proper re-insertion.
Objects of this type cannot be copied, but just moved.
Definition at line 562 of file hashtable.hpp.
#include <hashtable.hpp>
Public Method Index: | |
ElementHandle () | |
Default constructor creating and empty handle. | |
ElementHandle (ElementHandle &&other) | |
ElementHandle (ElementHandle &other)=delete | |
Deleted copy constructor. | |
~ElementHandle () | |
bool | IsEmpty () const |
KeyType & | Key () const |
MappedType & | Mapped () const |
ElementHandle & | operator= (const ElementHandle &other)=delete |
Deleted copy assignment operator. | |
ElementHandle & | operator= (ElementHandle &&other) |
StoredType & | Value () const |
Private Field Index: | |
Element * | element |
The extracted element. | |
HashTable * | table |
The table we belong to. | |
Private Method Index: | |
ElementHandle (HashTable *pTable, Element *pElement) | |
|
private |
The extracted element.
Definition at line 570 of file hashtable.hpp.
|
private |
The table we belong to.
Definition at line 569 of file hashtable.hpp.
|
inlineprivate |
Constructor setting fields table and element.
pTable | The table we belong to. |
pElement | The extracted element. |
Definition at line 575 of file hashtable.hpp.
|
inline |
Move constructor setting the moved object to emtpy.
other | The handle to move. |
Definition at line 583 of file hashtable.hpp.
|
inline |
Default constructor creating and empty handle.
Definition at line 591 of file hashtable.hpp.
|
inline |
Destructor. If this handle is not empty, the allocated storage of the represented element is added to the list of recyclable objects.
Definition at line 617 of file hashtable.hpp.
|
inline |
Determines if this is a "valid" handle.
true
if this objects represents a valid element, false
otherwise. Definition at line 626 of file hashtable.hpp.
|
inline |
Returns a mutable reference to the key-portion of this element's data. Must not be invoked on empty instances.
Definition at line 637 of file hashtable.hpp.
|
inline |
Returns a mutable reference to the mapped-portion of this element's data. Must not be invoked on empty instances.
Definition at line 642 of file hashtable.hpp.
|
inline |
Move assignment. Disposes any current content, and moves other into this.
other | The handle to move into this object. |
this
. Definition at line 604 of file hashtable.hpp.
|
inline |
Returns a mutable reference to this element's data. Must not be invoked on empty instances.
Definition at line 631 of file hashtable.hpp.