A value of this type is returned by the methods Extract, which allow 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 532 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 539 of file hashtable.hpp.
|
private |
The table we belong to.
Definition at line 538 of file hashtable.hpp.
|
inlineprivate |
Constructor setting fields table and element.
| pTable | The table we belong to. |
| pElement | The extracted element. |
Definition at line 544 of file hashtable.hpp.
|
inline |
Move constructor setting the moved object to emtpy.
| other | The handle to move. |
Definition at line 551 of file hashtable.hpp.
|
inline |
Default constructor creating and empty handle.
Definition at line 556 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 580 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 585 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 596 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 601 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 568 of file hashtable.hpp.
|
inline |
Returns a mutable reference to this element's data. Must not be invoked on empty instances.
Definition at line 590 of file hashtable.hpp.