![]() |
MySQL 9.6.0
Source Code Documentation
|
Container for intervals. More...
#include <interval_container.h>
Public Member Functions | |
| Interval_container () noexcept=default | |
| Default constructor. More... | |
| Interval_container (const Interval_container &source)=default | |
| Copy constructor. More... | |
| Interval_container (Interval_container &&source) noexcept=default | |
| Move constructor, defaulted. More... | |
| Interval_container & | operator= (const Interval_container &source)=default |
| Copy assignment operator. More... | |
| Interval_container & | operator= (Interval_container &&source) noexcept=default |
| Move assignment operator, defaulted. More... | |
| ~Interval_container () noexcept=default | |
| Destructor. More... | |
| Interval_container (const Memory_resource_t &memory_resource) noexcept | |
| Construct an empty container using the specified Memory_resource. More... | |
| Interval_container (const Is_interval_set_over_traits< Set_traits_t > auto &source) | |
| Construct by copying any other Interval_set over the same boundary traits. More... | |
| Interval_container (const Is_interval_set_over_traits< Set_traits_t > auto &source, const Memory_resource_t &memory_resource) | |
| Construct by copying any other Interval_set over the same boundary traits. More... | |
| Interval_container & | operator= (const Is_interval_set_over_traits< Set_traits_t > auto &source) |
| Assign from any other Boundary_set over the same Set traits. More... | |
| template<Is_interval_set_over_traits_unqualified< Set_traits_t > Source_t> | |
| auto | assign (Source_t &&source) |
Overwrite this object with source (copy-assigned). More... | |
| decltype(auto) | get_memory_resource () const noexcept |
| Return the Memory_resource object that manages memory in this object, or a default-constructed Memory_resource if there is none. More... | |
| void | clear () noexcept |
| Make this container empty. More... | |
| auto & | boundaries () &noexcept |
| Return an lvalue reference to the underlying boundary container. More... | |
| const auto & | boundaries () const &noexcept |
| Return a const lvalue reference to the underlying boundary container. More... | |
| auto && | boundaries () &&noexcept |
| Return an rvalue reference to the underlying boundary container. More... | |
| auto | insert (const Element_t &element) |
| Insert the given element (inplace union). More... | |
| auto | remove (const Element_t &element) |
| Remove the given element (inplace subtraction). More... | |
| auto | inplace_union (const Interval_t &interval) |
| Insert the given interval (inplace union). More... | |
| auto | inplace_union (Boundary_iterator_t &cursor, const Interval_t &interval) |
| Insert the given interval (inplace union), reading and updating the given cursor. More... | |
| template<Is_interval_set_over_traits_unqualified< Set_traits_t > Interval_set_t> | |
| auto | inplace_union (Interval_set_t &&interval_set) |
| In-place insert the intervals of the given set into this container (inplace union). More... | |
| auto | inplace_subtract (const Interval_t &interval) |
| Subtract the given interval. More... | |
| auto | inplace_subtract (Boundary_iterator_t &cursor, const Interval_t &interval) |
| Subtract the given interval, reading and updating the given cursor. More... | |
| template<Is_interval_set_over_traits_unqualified< Set_traits_t > Interval_set_t> | |
| auto | inplace_subtract (Interval_set_t &&interval_set) |
| In-place subtract intervals of the given set from this container. More... | |
| void | inplace_intersect (const Interval_t &interval) noexcept |
| In-place intersect this container with the given interval. More... | |
| template<Is_interval_set_over_traits_unqualified< Set_traits_t > Interval_set_t> | |
| auto | inplace_intersect (Interval_set_t &&interval_set) |
| In-place intersect this container with the given set. More... | |
Public Member Functions inherited from mysql::sets::Interval_set_interface< Interval_container< Boundary_container_tp >, Boundary_container_tp > | |
| const auto & | disjoint_pairs_source () const |
| auto & | disjoint_pairs_source () |
Public Member Functions inherited from mysql::ranges::Disjoint_pairs_interface< Self_tp, Make_pair_tp > | |
| auto | begin () const |
| Return const iterator to the beginning. More... | |
| auto | end () const |
| Return const iterator to sentinel. More... | |
| auto | begin () |
| Return iterator to the beginning. More... | |
| auto | end () |
| Return iterator to sentinel. More... | |
| bool | empty () const |
| Return true if the range is empty. More... | |
| bool | empty () const |
| Return true if the range is empty. More... | |
| auto | size () const |
| Return the number of pairs, i.e., half the size of the source. More... | |
| auto | size () const |
| Return the number of pairs, i.e., half the size of the source. More... | |
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... | |
Static Public Attributes | |
| static constexpr bool | has_fast_insertion |
Private Types | |
| using | Base_t = Interval_set_interface< This_t, Boundary_container_t > |
Private Attributes | |
| Boundary_container_t | m_boundaries |
Static Private Attributes | |
| static constexpr bool | noexcept_insertions |
Container for intervals.
| Boundary_container_tp | Boundary container, i.e., a Boundary set capable of storing the data, and computing inplace operations. |
| using mysql::sets::Interval_container< Boundary_container_tp >::Allocator_t = typename Boundary_container_t::Allocator_t |
|
private |
| using mysql::sets::Interval_container< Boundary_container_tp >::Boundary_container_t = Boundary_container_tp |
| using mysql::sets::Interval_container< Boundary_container_tp >::Boundary_iterator_t = typename Boundary_container_t::Iterator_t |
| using mysql::sets::Interval_container< Boundary_container_tp >::Interval_t = Interval<Set_traits_t> |
| using mysql::sets::Interval_container< Boundary_container_tp >::Memory_resource_t = mysql::allocators::Memory_resource |
| using mysql::sets::Interval_container< Boundary_container_tp >::Storage_t = Storage_or_void<Boundary_container_t> |
| using mysql::sets::Interval_container< Boundary_container_tp >::This_t = Interval_container<Boundary_container_t> |
|
defaultnoexcept |
Default constructor.
|
default |
Copy constructor.
This copy constructor is only enabled when the underlying boundary container is throwing. For non-throwing containers, use the default constructor followed by the assign member function instead.
| bad_alloc | This may occur when the operation is half-completed, which may leave the container as a subset of source. |
|
defaultnoexcept |
Move constructor, defaulted.
|
defaultnoexcept |
Destructor.
This is defaulted, so it will just invoke the destructor for m_boundaries.
|
inlineexplicitnoexcept |
Construct an empty container using the specified Memory_resource.
|
inlineexplicit |
Construct by copying any other Interval_set over the same boundary traits.
This copy constructor is only enabled when the underlying boundary container is copy-constructible, i.e., when it is throwing. For non-throwing containers, use the default constructor followed by the assign member function instead.
| bad_alloc | This may occur when the operation is half-completed, which may leave the container as a subset of source. |
|
inlineexplicit |
Construct by copying any other Interval_set over the same boundary traits.
This copy constructor is only enabled when the underlying boundary container is copy-constructible, i.e., when it is throwing. For non-throwing containers, use the default constructor followed by the assign member function instead.
| bad_alloc | This may occur when the operation is half-completed, which may leave the container as a subset of source. |
| auto mysql::sets::Interval_container< Boundary_container_tp >::assign | ( | Source_t && | source | ) |
Overwrite this object with source (copy-assigned).
This is equivalent to the copy assignment operator, and provided only in order for uniformity of this API and the non-throwing API.
If the boundary underlying set cannot fail (e.g. the argument is an rvalue reference to a type satisfying Can_donate_set), this returns void and does not throw. Otherwise, out-of-memory conditions may be possible. Then, if an out-of-memory condition occurred while inserting the interval, this returns error or throws bad_alloc according to the underlying boundary container. If the out-of-memory condition occurs when the operation is half-completed, it may leave the container as a subset of source.
|
inlinenoexcept |
Return an rvalue reference to the underlying boundary container.
The caller may modify the container through that reference, which will affect this interval container.
|
inlinenoexcept |
Return an lvalue reference to the underlying boundary container.
The caller may modify the container through that reference, which will affect this interval container.
|
inlinenoexcept |
Return a const lvalue reference to the underlying boundary container.
|
inlinenoexcept |
Make this container empty.
This function cannot fail.
|
inlinenoexcept |
Return the Memory_resource object that manages memory in this object, or a default-constructed Memory_resource if there is none.
|
inlinenoexcept |
In-place intersect this container with the given interval.
This may truncate intervals that overlap partially with the given interval, and remove intervals that are disjoint from the given interval.
Algorithm and complexity:
| interval | The interval to intersect with. |
Since this cannot increase the number of intervals, it never fails.
| auto mysql::sets::Interval_container< Boundary_container_tp >::inplace_intersect | ( | Interval_set_t && | interval_set | ) |
In-place intersect this container with the given set.
This may truncate intervals that overlap partially with one interval from the given set, split intervals that overlap partially with more than one interval from the given set, and remove intervals that are disjoint from the given interval set.
Algorithm and complexity:
| interval_set | The interval set. |
If an out-of-memory condition occurred while splitting an interval, this returns error or throws bad_alloc according to the underlying boundary container. This may occur when the operation is half-completed, which may leave the container as a subset of the previous set and a superset of the intersection.
| auto mysql::sets::Interval_container< Boundary_container_tp >::inplace_subtract | ( | Boundary_iterator_t & | cursor, |
| const Interval_t & | interval | ||
| ) |
Subtract the given interval, reading and updating the given cursor.
This may truncate and/or split intervals that overlap partially with the subtracted interval, and remove intervals that overlap completely with the subtracted interval.
| [in,out] | cursor | Hint for the position. |
| interval | The interval to remove. |
If an out-of-memory condition occurred while splitting an interval, this returns error or throws bad_alloc according to the underlying boundary container. This leaves the container unmodified.
| auto mysql::sets::Interval_container< Boundary_container_tp >::inplace_subtract | ( | const Interval_t & | interval | ) |
Subtract the given interval.
This may truncate and/or split intervals that overlap partially with the subtracted interval, and remove intervals that overlap completely with the subtracted interval.
| interval | The interval to remove. |
If an out-of-memory condition occurred while splitting an interval, this returns error or throws bad_alloc according to the underlying boundary container. This leaves the container unmodified.
| auto mysql::sets::Interval_container< Boundary_container_tp >::inplace_subtract | ( | Interval_set_t && | interval_set | ) |
In-place subtract intervals of the given set from this container.
This may truncate and/or split intervals that overlap partially with subtracted intervals, and remove intervals that overlap completely with subtracted intervals.
Algorithm and complexity:
| interval_set | The interval set. |
If an out-of-memory condition occurred while splitting an interval, this returns error or throws bad_alloc according to the underlying boundary container. This may occur when the operation is half-completed, which may leave the container as a subset of the previous set and a superset of the difference.
| auto mysql::sets::Interval_container< Boundary_container_tp >::inplace_union | ( | Boundary_iterator_t & | cursor, |
| const Interval_t & | interval | ||
| ) |
Insert the given interval (inplace union), reading and updating the given cursor.
This may merge intervals that are overlapping or adjacent with the given interval.
| [in,out] | cursor | Hint for the position. |
| interval | The interval to insert. |
If an out-of-memory condition occurred while inserting an interval, this returns error or throws bad_alloc according to the underlying boundary container. This leaves the container unmodified.
| auto mysql::sets::Interval_container< Boundary_container_tp >::inplace_union | ( | const Interval_t & | interval | ) |
Insert the given interval (inplace union).
This may merge intervals that are overlapping or adjacent with the given interval.
| interval | The interval to insert. |
If an out-of-memory condition occurred while inserting an interval, this returns error or throws bad_alloc according to the underlying boundary container. This leaves the container unmodified.
| auto mysql::sets::Interval_container< Boundary_container_tp >::inplace_union | ( | Interval_set_t && | interval_set | ) |
In-place insert the intervals of the given set into this container (inplace union).
This may merge intervals that are overlapping or adjacent.
This uses one of two algorithms, depending on the nature of the underlying storage:
The complexity depends on the underlying storage:
| interval_set | The interval set. |
If an out-of-memory condition occurred while inserting an interval, this returns error or throws bad_alloc according to the underlying boundary container. This may occur when the operation is half-completed, which may leave the container as a superset of the previous set and a subset of the union.
| auto mysql::sets::Interval_container< Boundary_container_tp >::insert | ( | const Element_t & | element | ) |
Insert the given element (inplace union).
This may merge adjacent intervals.
| element | The element to insert. |
If an out-of-memory condition occurred while inserting the interval, this returns error or throws bad_alloc according to the underlying boundary container. This leaves the container unmodified.
We use [[nodiscard]] rather than [[nodiscard]], because nodiscard gives a warning even if auto resolves to void, whereas nodiscard does not.
|
default |
Copy assignment operator.
This copy assignment operator is only enabled when the underlying boundary container is throwing. For non-throwing containers, use assign instead.
| bad_alloc | This may occur when the operation is half-completed, which may leave the container as a subset of source. |
|
inline |
Assign from any other Boundary_set over the same Set traits.
This copy assignment operator is only enabled when the underlying boundary container is copy-constructible, i.e., when it is throwing. For non-throwing containers, use assign instead.
| bad_alloc | This may occur when the operation is half-completed, which may leave the container as a subset of source. |
|
defaultnoexcept |
Move assignment operator, defaulted.
| auto mysql::sets::Interval_container< Boundary_container_tp >::remove | ( | const Element_t & | element | ) |
Remove the given element (inplace subtraction).
This may truncate and/or split an interval that overlaps with the subtracted interval.
| element | The element to remove. |
If an out-of-memory condition occurred while splitting an interval, this returns error or throws bad_alloc according to the underlying boundary container. This leaves the container unmodified.
|
staticconstexpr |
|
private |
|
staticconstexprprivate |