![]() |
MySQL 9.6.0
Source Code Documentation
|
Represents the subset of a Cartesian product "L x R" of two sets, using a map data structure that maps elements of type L to containers holding values of type R. More...
#include <nested_container.h>
Public Member Functions | |
| template<class... Args_t> requires mysql::meta::Not_decayed<This_t, Args_t...> | |
| Nested_container (Args_t &&...args) noexcept | |
| Construct a new, empty Nested_container. More... | |
| auto & | storage () noexcept |
| Return non-const reference to the underlying storage. More... | |
| const auto & | storage () const noexcept |
| Return const reference to the underlying storage. More... | |
| Const_iterator_t | find (const Key_t &key) const noexcept |
| Return const iterator to the pair having the given key in the first component, or end() if the key is not in the set. More... | |
| Iterator_t | find (const Key_t &key) noexcept |
| Return iterator to the pair having the given key in the first component, or end() if the key is not in the set. More... | |
| Const_iterator_t | find (Const_iterator_t &cursor, const Key_t &key) const noexcept |
| Return const iterator to the pair having the given key in the first component, or end() if the key is not in the set. More... | |
| Iterator_t | find (Iterator_t &cursor, const Key_t &key) noexcept |
| Return iterator to the pair having the given key in the first component, or end() if the key is not in the set. More... | |
| template<class... Mapped_args_t> | |
| Return_status_t | insert (const Key_t &key, Mapped_args_t &&...mapped_args) noexcept |
| Insert the given element (inplace union). More... | |
| Return_status_t | remove (const Key_t &key, const auto &...value) noexcept |
| Remove the given element from the set, if it is there. More... | |
| template<class... Mapped_args_t> | |
| auto | inplace_union (const Key_t &key, Mapped_args_t &&...mapped_args) noexcept |
| Insert the given set (inplace union). More... | |
| template<class... Mapped_args_t> | |
| auto | inplace_union (Iterator_t &cursor, const Key_t &key, Mapped_args_t &&...mapped_args) noexcept |
| Insert the given set (inplace union), reading and updating the given cursor. More... | |
| template<Is_nested_set_over_traits_unqualified< Set_traits_t > Other_set_t> | |
| auto | inplace_union (Other_set_t &&other_set) noexcept |
| Inplace-insert the given set (inplace union) into this container. More... | |
| void | inplace_subtract (const Key_t &key) noexcept |
| Inplace-remove the given key and associated mapped set. More... | |
| template<class... Mapped_args_t> | |
| auto | inplace_subtract (const Key_t &key, Mapped_args_t &&...mapped_args) noexcept |
| Inplace-remove the given mapped set from the mapped set associated with the given key. More... | |
| template<class... Mapped_args_t> | |
| auto | inplace_subtract (Iterator_t &cursor, const Key_t &key, Mapped_args_t &&...mapped_args) noexcept |
| Inplace-remove the given mapped set from the mapped set associated with the given key, reading and updating the given cursor. More... | |
| template<Is_nested_set_over_traits_unqualified< Set_traits_t > Other_set_t> | |
| auto | inplace_subtract (Other_set_t &&other_set) noexcept |
| Inplace-remove the given set from this container. More... | |
| void | inplace_intersect (const Key_t &key) noexcept |
| Inplace-remove all value pairs, except the one for the given key. More... | |
| template<class... Mapped_args_t> | |
| auto | inplace_intersect (const Key_t &key, Mapped_args_t &&...mapped_args) noexcept |
| Inplace-remove all value pairs, except the one for the given key, and inplace-intersect the mapped container for the given key with the given mapped set. More... | |
| template<Is_nested_set_over_traits_unqualified< Set_traits_t > Other_set_t> | |
| auto | inplace_intersect (Other_set_t &&other_set) noexcept |
| Inplace-intersect this set with the given set. More... | |
Public Member Functions inherited from mysql::sets::Basic_nested_container_wrapper< Nested_container< Storage_tp >, Storage_tp > | |
| Basic_nested_container_wrapper (Args_t &&...args) noexcept(noexcept(Wrapper_base_t(std::forward< Args_t >(args)...))) | |
Public Member Functions inherited from mysql::sets::Basic_set_container_wrapper< Self_tp, Wrapped_tp, shall_catch_tp > | |
| template<class... Args_t> | |
| Basic_set_container_wrapper (Args_t &&...args) | |
| template<class Source_t > requires Can_donate_set<decltype(std::declval<Source_t &&>().wrapped()), Wrapped_tp> | |
| void | assign (Source_t &&source) |
| Enable move-assign from any Basic_set_container_wrapper for a compatible set type (not necessarily for a derived class). More... | |
| template<std::input_iterator First_iterator_t, std::sentinel_for< First_iterator_t > Sentinel_t> requires requires(Wrapped_t w, First_iterator_t f, Sentinel_t s) { w.assign(f, s); } | |
| auto | assign (const First_iterator_t &first, const Sentinel_t &last) noexcept(shall_catch==mysql::utils::Shall_catch::yes||noexcept(std::declval< Wrapped_t >().assign(first, last))) |
| Assign a range defined by the two iterators to the wrapped object. More... | |
| template<class Other_t > | |
| auto | assign (const Other_t &other) noexcept(shall_catch==mysql::utils::Shall_catch::yes||noexcept(std::declval< Self_t >().assign(other.begin(), other.end()))) |
| Copy-assign the other object to the wrapped object. More... | |
| void | assign (Self_t &&other) noexcept |
| Move-assign the other object to the wrapped object. More... | |
Public Member Functions inherited from mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, mysql::utils::Shall_catch::no > | |
| Basic_container_wrapper (Args_t &&...args) noexcept(noexcept(Wrapped_t(std::forward< Args_t >(args)...))) | |
| Constructor that delegates all parameters to the constructor of the wrapped class. More... | |
| auto | assign (const First_iterator_t &first, const Sentinel_t &last) noexcept(shall_catch==mysql::utils::Shall_catch::yes||noexcept(std::declval< Wrapped_t >().assign(first, last))) |
| Assign a range defined by the two iterators to the wrapped object. More... | |
| auto | assign (const Other_t &other) noexcept(shall_catch==mysql::utils::Shall_catch::yes||noexcept(std::declval< Self_t >().assign(other.begin(), other.end()))) |
| Copy-assign the other object to the wrapped object. More... | |
| void | assign (Self_t &&other) noexcept |
| Move-assign the other object to the wrapped object. More... | |
| void | clear () noexcept |
| Clear the wrapped object. More... | |
| auto | get_memory_resource () const noexcept |
| Return the memory resource used by the wrapped object. More... | |
| auto | get_allocator () const noexcept |
| Return the allocator used by the wrapped object. More... | |
| auto | begin () noexcept |
| auto | begin () const noexcept |
| auto | end () noexcept |
| auto | end () const noexcept |
| auto | empty () const noexcept |
| auto | size () const noexcept |
Public Member Functions inherited from mysql::ranges::Collection_interface< Self_tp > | |
| constexpr auto | cbegin () const |
| Return constant iterator to the beginning. More... | |
| constexpr auto | cend () const |
| Return constant iterator to the end. More... | |
| constexpr auto | rbegin () |
| Return reverse iterator to the beginning. More... | |
| constexpr auto | rend () |
| Return reverse iterator to the end. More... | |
| constexpr auto | rbegin () const |
| Return const reverse iterator to the beginning. More... | |
| constexpr auto | rend () const |
| Return const reverse iterator to the end. More... | |
| constexpr auto | crbegin () const |
| Return const reverse iterator to the beginning. More... | |
| constexpr auto | crend () const |
| Return const reverse iterator to the end. More... | |
| constexpr bool | empty () const |
| Return true if the range is empty, i.e., begin() == end(). More... | |
| constexpr | operator bool () const |
| Return true if the range is non-empty, i.e., begin() != end(). More... | |
| constexpr bool | operator! () const |
| Return true if the range is empty, i.e., begin() == end(). More... | |
| constexpr auto | size () const |
| Return the number of elements in this view, unsigned (size_t), by computing std::ranges::distance(begin, end) More... | |
| constexpr auto | ssize () const |
| Return the number of elements in this view, signed (ptrdiff_t). More... | |
| constexpr decltype(auto) | front () const |
| Return the first element. More... | |
| constexpr decltype(auto) | back () const |
| Return the last element. Enabled if we have bidirectional iterators. More... | |
| constexpr decltype(auto) | operator[] (std::ptrdiff_t n) |
| Return the n'th element, possibly mutable. More... | |
| constexpr decltype(auto) | operator[] (std::ptrdiff_t n) const |
| Return the n'th element, const. More... | |
| constexpr auto * | data () |
| Return pointer to underlying contiguous memory. More... | |
| constexpr auto * | data () const |
| Return const pointer to underlying contiguous memory. More... | |
Public Member Functions inherited from mysql::sets::detail::Nested_set_interface< Self_tp, Iterator_tp, Const_iterator_tp, Set_traits_tp > | |
| auto & | operator[] (const Key_t &key) noexcept |
| Return non-const reference to the mapped Set for the given key. More... | |
| const auto & | operator[] (const Key_t &key) const noexcept |
| Return const reference to the mapped Set for the given key. More... | |
Static Public Attributes | |
| static constexpr Return_status_t | return_ok = Return_status_t::ok |
Private Member Functions | |
| template<class... Mapped_args_t> | |
| auto | insert_or_union (const auto &func, const auto &opt_it, Mapped_args_t &&...mapped_args) noexcept |
Common implementation for insert and several of the inplace_union operations: it performs the insertion operation, given an iterator to the key-value pair and a mapped set. More... | |
| void | advance_and_erase_if_empty (Iterator_t &iterator) noexcept |
| Helper that will erase the value pair that the iterator points to if it is empty, and, regardless if it erased or not, make the iterator point to the next element. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, mysql::utils::Shall_catch::no > | |
| auto & | wrapped () &noexcept |
| const auto & | wrapped () const &noexcept |
| auto && | wrapped () &&noexcept |
Represents the subset of a Cartesian product "L x R" of two sets, using a map data structure that maps elements of type L to containers holding values of type R.
This never throws exceptions. All member functions that can fail, return a status and have the [[nodiscard]] attribute.
| Storage_tp | Underlying storage |
| using mysql::sets::Nested_container< Storage_tp >::Base_t = Basic_nested_container_wrapper<Nested_container<Storage_tp>, Storage_tp> |
| using mysql::sets::Nested_container< Storage_tp >::Memory_resource_t = mysql::allocators::Memory_resource |
| using mysql::sets::Nested_container< Storage_tp >::Return_status_t = mysql::utils::Return_status |
| using mysql::sets::Nested_container< Storage_tp >::Set_category_t = Nested_set_category_tag |
| using mysql::sets::Nested_container< Storage_tp >::Storage_t = Storage_tp |
| using mysql::sets::Nested_container< Storage_tp >::This_t = Nested_container<Storage_t> |
|
inlineexplicitnoexcept |
Construct a new, empty Nested_container.
| args | any arguments are passed to the base class. |
|
inlineprivatenoexcept |
Helper that will erase the value pair that the iterator points to if it is empty, and, regardless if it erased or not, make the iterator point to the next element.
This will point to the next element even if an erase operation was performed which invalidated iterators.
| iterator | Iterator to operate on. |
|
inlinenoexcept |
Return const iterator to the pair having the given key in the first component, or end() if the key is not in the set.
| key | Key to look for. |
|
inlinenoexcept |
Return iterator to the pair having the given key in the first component, or end() if the key is not in the set.
| key | Key to look for. |
|
inlinenoexcept |
Return const iterator to the pair having the given key in the first component, or end() if the key is not in the set.
| key | Key to look for. | |
| [in,out] | cursor | Iterator hint. If this is greater than the lower bound for key, the behavior is undefined. It will be updated to the upper bound for the key. Thus, it is suitable to use in successive calls to this function with increasing keys. This is not nodiscard because someone may want to only advance the cursor. |
|
inlinenoexcept |
Return iterator to the pair having the given key in the first component, or end() if the key is not in the set.
| key | Key to look for. | |
| [in,out] | cursor | Iterator hint. If this is greater than the lower bound for key, the behavior is undefined. It will be updated to the upper bound for the key. Thus, it is suitable to use in successive calls to this function with increasing keys. This is not nodiscard because someone may want to only advance the cursor. |
|
inlinenoexcept |
Inplace-remove all value pairs, except the one for the given key.
| key | Key to keep. |
This operation cannot fail.
|
inlinenoexcept |
Inplace-remove all value pairs, except the one for the given key, and inplace-intersect the mapped container for the given key with the given mapped set.
| key | Key to keep. |
| mapped_args | Arguments to pass to inplace_intersect on the mapped set. |
|
inlinenoexcept |
Inplace-intersect this set with the given set.
If other_set is an rvalue reference, any time this function makes a recursive call to inplace_intersect on the mapped sets, it will pass an rvalue reference to a mapped set in other_set. This possibly enables stealing, if allowed by the types and allocators of those sets. If stealing is possible on all nesting levels, this cannot fail.
| other_set | Set to intersect with. |
inplace_intersect member of the mapped set fails. This may leave the container as a subset of the previous set and a superset of the intersection.
|
inlinenoexcept |
Inplace-remove the given key and associated mapped set.
| key | Key to remove. |
This operation cannot fail.
|
inlinenoexcept |
Inplace-remove the given mapped set from the mapped set associated with the given key.
| key | Key to find. |
| mapped_args | Arguments passed to inplace_subtract of the mapped set. |
inplace_subtract member function of the mapped container type can fail. It may leave this set as a subset of the old set and a superset of the difference set.
|
inlinenoexcept |
Inplace-remove the given mapped set from the mapped set associated with the given key, reading and updating the given cursor.
| [in,out] | cursor | Hint for the position of the key. If this is greater than the lower bound for key, the behavior is undefined. It will be updated to point to the element following key, which makes it good to reuse for future calls to this function, with keys following this one. |
| key | Key to find. | |
| mapped_args | Arguments passed to inplace_subtract of the mapped set. |
inplace_subtract member function of the mapped container type can fail. It may leave this set as a subset of the old set and a superset of the difference set.
|
inlinenoexcept |
Inplace-remove the given set from this container.
This iterates over value pairs of this container and value pairs of the other set, where the key part of the two pairs are equal. In each step, it invokes inplace_subtract on the mapped container, passing the mapped other set as parameter. The number of iterations over value pairs is bounded by min(this->size, other_set.size()).
If other_set is an rvalue reference, any time this function makes a recursive call to inplace_subtract on the mapped sets, it will pass an rvalue reference to a mapped set in other_set. This possibly enables stealing, if allowed by the types and allocators of those sets. If stealing is possible on all nesting levels, this cannot fail.
| other_set | Set to subtract |
inplace_subtract member of the mapped set fails. This may leave the container as a subset of the previous set and a superset of the difference.
|
inlinenoexcept |
Insert the given set (inplace union).
This will create the value pair with the given key and an empty mapped container if it does not exist. Then it will invoke the inplace_union member function of the mapped container.
| key | Key of the element to insert. |
| mapped_args | Arguments passed to the inplace_union member function of the mapped container. |
inplace_union for the mapped container. This may leave the container as a superset of the previous set and a subset of the union.
|
inlinenoexcept |
Insert the given set (inplace union), reading and updating the given cursor.
This will create the value pair with the given key and an empty mapped container if it does not exist. Then it will invoke the inplace_union member function of the mapped container.
| [in,out] | cursor | Hint for the insertion position. If this is greater than the lower bound for key, the behavior is undefined. It will be updated to the element after the inserted one, which makes it good to reuse for future calls to this function, with keys following this one. |
| key | Key of the element to insert. | |
| mapped_args | Arguments passed to the inplace_union member function of the mapped container. |
inplace_union for the mapped container. This may leave the container as a superset of the previous set and a subset of the union.
|
inlinenoexcept |
Inplace-insert the given set (inplace union) into this container.
This will iterate over the input set and repeatedly invoke inplace_union(cursor, key, mapped).
If other_set is an rvalue reference, and its allocator compares equal with this Nested_container's allocator, and the set types satisfy Can_donate_set_elements, this steals elements from other and does not allocate elements in the Nested_set. The same applies on all levels of nested containers, i.e., the mapped sets may steal if their allocators compare equal and their types satisfy Can_donate_set_elements; and so on on all nesting levels. If stealing is possible on all levels, this cannot fail.
| other_set | Arguments passed to the inplace_union member function of the mapped container. |
inplace_union for the mapped container. This may leave the container as a superset of the previous set and a subset of the union.
|
inlinenoexcept |
Insert the given element (inplace union).
This will create the value pair with the given key and an empty mapped container if it does not exist. Then it will invoke the insert member function of the mapped container.
| key | Key of the element to insert. |
| mapped_args | Arguments passed to the insert member function of the mapped container. |
|
inlineprivatenoexcept |
Common implementation for insert and several of the inplace_union operations: it performs the insertion operation, given an iterator to the key-value pair and a mapped set.
| Mapped_args_t | Type of parameters passed to the lambda. |
| func | Callable that will perform the insert or inplace_union operation in the mapped set. It will be passed the mapped set, followed by the arguments in mapped_args. |
| opt_it | std::optional that may hold an iterator to the value pair on which the insert or inplace_union operation should operate. If this does not hold a value, this function returns Return_status::error immediately; otherwise it attempts to insert into the mapped container it points to. |
| mapped_args | Parameters to pass to func. |
opt_it does not hold a value, or func fails.
|
inlinenoexcept |
Remove the given element from the set, if it is there.
This will lookup the value pair in this set. If the key was found, remove the element from the mapped container by invoking its remove member function. If the resulting mapped container becomes empty, the value pair is removed from this container.
| key | Key of the element to insert. |
| value | Arguments passed to the remove member function of the mapped container. |
|
inlinenoexcept |
Return const reference to the underlying storage.
|
inlinenoexcept |
Return non-const reference to the underlying storage.
|
staticconstexpr |