|
FE 0.17.1
Fast, Effecient FrontEnds
|
A bijection between L and R that stores every pair once, in an ankerl::unordered_dense::segmented_map.
More...
#include <fe/bimap.h>
Public Types | |
| using | Left = ankerl::unordered_dense::segmented_map<L, R, LHash, LEq> |
| using | value_type = typename Left::value_type |
Public Member Functions | |
| BiNodeMap ()=default | |
| BiNodeMap (const BiNodeMap &other) | |
| BiNodeMap (BiNodeMap &&) noexcept=default | |
| BiNodeMap & | operator= (const BiNodeMap &other) |
| BiNodeMap & | operator= (BiNodeMap &&) noexcept=default |
Getters | |
| const Left & | left () const noexcept |
| size_t | size () const noexcept |
| bool | empty () const noexcept |
| auto | begin () const noexcept |
| auto | end () const noexcept |
Lookup | |
at_left() and at_right() throw std::out_of_range if the key is unbound. | |
| bool | contains_left (const auto &l) const |
| bool | contains_right (const auto &r) const |
| const R & | at_left (const auto &l) const |
| const L & | at_right (const auto &r) const |
| template<class K> | |
| Ptr | find_right (const K &r) const |
Yields the pair whose right side is r, or nullptr. | |
Modifiers | |
They take their arguments by value, so a reference into this BiNodeMap cannot dangle halfway through. | |
| bool | insert (L l, R r) |
Binds l to r unless either is already bound; yields whether it did. | |
| void | insert_or_assign (L l, R r) |
Binds l to r after unbinding whatever either was bound to. | |
| bool | erase_left (const auto &l) |
Unbinds l and its partner; yields whether l was bound. | |
| bool | erase_right (const auto &r) |
Unbinds r and its partner; yields whether r was bound. | |
| void | reserve (size_t n) |
| void | clear () noexcept |
Friends | |
| bool | operator== (const BiNodeMap &a, const BiNodeMap &b) |
A bijection between L and R that stores every pair once, in an ankerl::unordered_dense::segmented_map.
The right side is a set of pointers to those pairs, hashed and compared by their R. An insert never moves a pair, and neither does moving the BiNodeMap itself. An erase, however, moves the last pair into the freed slot, as it does in any ankerl::unordered_dense map. Its interface is that of BiMap, except that right() has no map to yield; find_right() takes its place.
| using fe::BiNodeMap< L, R, LHash, LEq, RHash, REq >::Left = ankerl::unordered_dense::segmented_map<L, R, LHash, LEq> |
| using fe::BiNodeMap< L, R, LHash, LEq, RHash, REq >::value_type = typename Left::value_type |
|
default |
Referenced by BiNodeMap(), BiNodeMap(), operator=(), operator=(), and operator==.
|
inline |
Definition at line 171 of file bimap.h.
References BiNodeMap().
|
defaultnoexcept |
References BiNodeMap().
|
inlinenodiscard |
|
inlinenodiscard |
Definition at line 200 of file bimap.h.
References find_right().
|
inlinenodiscardnoexcept |
|
inlinenoexcept |
|
inlinenodiscard |
|
inlinenodiscard |
Definition at line 198 of file bimap.h.
References find_right().
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
|
inline |
Unbinds l and its partner; yields whether l was bound.
Definition at line 236 of file bimap.h.
Referenced by insert_or_assign().
|
inline |
Unbinds r and its partner; yields whether r was bound.
Definition at line 244 of file bimap.h.
References find_right().
Referenced by insert_or_assign().
|
inlinenodiscard |
Yields the pair whose right side is r, or nullptr.
Definition at line 207 of file bimap.h.
References find_right().
Referenced by at_right(), contains_right(), erase_right(), and find_right().
|
inline |
|
inline |
Binds l to r after unbinding whatever either was bound to.
Definition at line 229 of file bimap.h.
References erase_left(), and erase_right().
|
inlinenodiscardnoexcept |
|
defaultnoexcept |
References BiNodeMap().
|
inline |
Definition at line 179 of file bimap.h.
References BiNodeMap().
|
inline |
|
inlinenodiscardnoexcept |
|
friend |
Definition at line 262 of file bimap.h.
References BiNodeMap().