|
Flow 2.0.0
Flow project: Full implementation reference.
|
The internal-use key/iterator-wrapper, used as the key type in internal-use set-type Linked_hash_key_set. More...
#include <linked_hash.hpp>
Public Types | |
| using | Key = Key_t |
| Convenience alias for template arg. More... | |
| using | Iterator = Iterator_t |
| Convenience alias for template arg. More... | |
Public Member Functions | |
| Linked_hash_key (const Key &key) | |
Constructs *this to contain a pointer to a Key living outside the *this-using data structure Linked_hash_key_set (presumably as arg to its .find()). More... | |
| Linked_hash_key (const Iterator &it) | |
Constructs *this to contain an Iterator into the *this-using data structure Linked_hash_key_set (presumably as arg to its .insert()). More... | |
| const Key & | key () const |
| Returns reference to immutable key to which we saved a pointer via one of our constructor forms. More... | |
| Iterator | iter () const |
| Assuming we were as-if constructed via the ctor that takes an Iterator (as opposed to a Key reference), returns copy of the stored iterator. More... | |
Static Public Attributes | |
| static constexpr bool | S_IS_ITER_TO_PAIR = IS_ITER_TO_PAIR |
| Convenience alias for template arg. More... | |
Private Types | |
| using | Key_ptr = Key const * |
Short-hand for raw pointer to an immutable Key living outside the *this-using data structure. More... | |
Private Attributes | |
| std::variant< Key_ptr, Iterator > | m_key_hndl |
| Stores the key, without copying its actual value, as either a pointer to an immutable key, or as an iterator into a structure such that it contains the key. More... | |
The internal-use key/iterator-wrapper, used as the key type in internal-use set-type Linked_hash_key_set.
For background please see Linked_hash_map doc header Impl section, and where that points. Note that the same information applies to Linked_hash_set as well. (IS_ITER_TO_PAIR indicates which guy this is helping implement.)
That said, we very specifically just need to:
*this is used as the arg to Linked_hash_key_set::find() or an Iterator copy (ditto but to Linked_hash_key_set::insert());Key or Iterator can be passed seamlessly into .find() and .insert() respectively);| Key_t | See Linked_hash_map, Linked_hash_set. |
| Iterator_t | Linked_hash_map::Iterator or Linked_hash_set::Iterator. |
| IS_ITER_TO_PAIR | true for Linked_hash_map, false for Linked_hash_set. |
Definition at line 52 of file linked_hash.hpp.
| using flow::util::Linked_hash_key< Key_t, Iterator_t, IS_ITER_TO_PAIR >::Iterator = Iterator_t |
Convenience alias for template arg.
Definition at line 61 of file linked_hash.hpp.
| using flow::util::Linked_hash_key< Key_t, Iterator_t, IS_ITER_TO_PAIR >::Key = Key_t |
Convenience alias for template arg.
Definition at line 58 of file linked_hash.hpp.
|
private |
Short-hand for raw pointer to an immutable Key living outside the *this-using data structure.
Definition at line 120 of file linked_hash.hpp.
| flow::util::Linked_hash_key< Key_t, Iterator_t, IS_ITER_TO_PAIR >::Linked_hash_key | ( | const Key & | key | ) |
Constructs *this to contain a pointer to a Key living outside the *this-using data structure Linked_hash_key_set (presumably as arg to its .find()).
| key | The key to which to point. The referred object must continue to be valid, until either *this is destroyed, or via assignment *this changes value. |
Definition at line 223 of file linked_hash.hpp.
| flow::util::Linked_hash_key< Key_t, Iterator_t, IS_ITER_TO_PAIR >::Linked_hash_key | ( | const Iterator & | it | ) |
Constructs *this to contain an Iterator into the *this-using data structure Linked_hash_key_set (presumably as arg to its .insert()).
| it | The iterator a copy of which to store. The pointee of the iterator must not be erased or moved in an iterator-invalidating fashion, until either *this is destroyed, or via assignment *this changes value. |
Definition at line 230 of file linked_hash.hpp.
| Iterator_t flow::util::Linked_hash_key< Key_t, Iterator_t, IS_ITER_TO_PAIR >::iter |
Assuming we were as-if constructed via the ctor that takes an Iterator (as opposed to a Key reference), returns copy of the stored iterator.
Behavior undefined if the assumption does not hold (as of this writing exception is thrown).
Informally: if this->key() was found in the Linked_hash_key_set, then this accessor may be used; else it may not. That *this-using data structure – a hash-set – shall use Linked_hash_key_hash and Linked_hash_key_pred for its hasher and equality functors respectively.
Definition at line 261 of file linked_hash.hpp.
| const Key_t & flow::util::Linked_hash_key< Key_t, Iterator_t, IS_ITER_TO_PAIR >::key |
Returns reference to immutable key to which we saved a pointer via one of our constructor forms.
Specifically, then, that's either simply the ctor-saved pointer (in reference form); or the address of the key stored as stored within the *this-using data structure Linked_hash_key_set.
Definition at line 238 of file linked_hash.hpp.
|
private |
Stores the key, without copying its actual value, as either a pointer to an immutable key, or as an iterator into a structure such that it contains the key.
In the latter case:
Linked_hash_key_* user (Linked_hash_set, Linked_hash_map). Definition at line 131 of file linked_hash.hpp.
|
staticconstexpr |
Convenience alias for template arg.
Definition at line 66 of file linked_hash.hpp.