24#ifndef MYSQL_SETS_NONTHROWING_BOUNDARY_CONTAINER_ADAPTOR_H
25#define MYSQL_SETS_NONTHROWING_BOUNDARY_CONTAINER_ADAPTOR_H
48template <Is_boundary_container Throwing_boundary_container_tp>
49 requires std::is_nothrow_default_constructible_v<
50 Throwing_boundary_container_tp> &&
51 std::is_nothrow_destructible_v<Throwing_boundary_container_tp>
54 Nonthrowing_boundary_container_adaptor<
55 Throwing_boundary_container_tp>,
56 Throwing_boundary_container_tp, mysql::utils::Shall_catch::yes> {
65 using Storage_t = Throwing_boundary_container_t::Storage_t;
67 using Allocator_t =
typename Throwing_boundary_container_t::Allocator_t;
72 Throwing_boundary_container_tp, mysql::utils::Shall_catch::yes>;
75 Throwing_boundary_container_t::has_fast_insertion;
91 :
Base_t(memory_resource) {}
107 return this->
wrapped().storage();
123 return mysql::utils::call_and_catch([&] {
throwing().insert(element); });
139 return mysql::utils::call_and_catch([&] {
throwing().remove(element); });
157 const Element_t &exclusive_end)
noexcept {
158 return mysql::utils::call_and_catch(
186 const Element_t &exclusive_end)
noexcept {
187 return mysql::utils::call_and_catch(
188 [&] {
throwing().inplace_union(cursor,
start, exclusive_end); });
227 template <Is_boundary_set_over_traits_unqualified<Set_traits_t> Input_set_t>
252 const Element_t &exclusive_end)
noexcept {
253 return mysql::utils::call_and_catch(
281 const Element_t &exclusive_end)
noexcept {
282 return mysql::utils::call_and_catch(
283 [&] {
throwing().inplace_subtract(cursor,
start, exclusive_end); });
302 template <Is_boundary_set_over_traits_unqualified<Set_traits_t> Input_set_t>
343 template <Is_boundary_set_over_traits_unqualified<Set_traits_t> Input_set_t>
347 std::forward<Input_set_t>(input_set))));
355 return Throwing_boundary_container_t::upper_bound_impl(
self.
throwing(),
364 return Throwing_boundary_container_t::lower_bound_impl(
self.
throwing(),
#define DEDUCED_NOEXCEPT_FUNCTION(X)
Helper macro to define a function that returns the result of a single expression, and has a condition...
Definition: call_and_catch.h:151
Polymorphism-free memory resource class with custom allocator and deallocator functions.
Definition: memory_resource.h:88
CRTP base class (mixin) to define a wrapper around a container.
Definition: basic_container_wrapper.h:59
auto & wrapped() &noexcept
Definition: basic_container_wrapper.h:183
CRTP base class/mixin, used to implement Boundary Sets that are container wrappers.
Definition: boundary_set_interface.h:128
Definition: basic_set_container_wrapper.h:47
Non-throwing container that stores boundaries.
Definition: nonthrowing_boundary_container_adaptor.h:56
const auto & storage() const noexcept
Return a const reference to the underlying storage.
Definition: nonthrowing_boundary_container_adaptor.h:106
auto inplace_union(Iterator_t &cursor, const Element_t &start, const Element_t &exclusive_end) noexcept
Insert the given interval (inplace union), reading and updating the given cursor.
Definition: nonthrowing_boundary_container_adaptor.h:185
Throwing_boundary_container_tp Throwing_boundary_container_t
Definition: nonthrowing_boundary_container_adaptor.h:58
auto inplace_intersect(const Element_t &start, const Element_t &exclusive_end) noexcept
In-place intersect this container with the given interval.
Definition: nonthrowing_boundary_container_adaptor.h:320
static constexpr bool has_fast_insertion
Definition: nonthrowing_boundary_container_adaptor.h:74
auto remove(const Element_t &element) noexcept
Remove the given element (inplace subtraction).
Definition: nonthrowing_boundary_container_adaptor.h:138
Nonthrowing_boundary_container_adaptor() noexcept=default
Default constructor.
auto & throwing() noexcept
Return a non-const reference to the underlying, throwing boundary container.
Definition: nonthrowing_boundary_container_adaptor.h:95
typename Throwing_boundary_container_t::Allocator_t Allocator_t
Definition: nonthrowing_boundary_container_adaptor.h:67
auto & storage() noexcept
Return a non-const reference to the underlying storage.
Definition: nonthrowing_boundary_container_adaptor.h:103
const auto & throwing() const noexcept
Return a const reference to the underlying, throwing boundary container.
Definition: nonthrowing_boundary_container_adaptor.h:98
auto inplace_intersect(Input_set_t &&input_set) noexcept
In-place intersect this container with intervals of the given container.
Definition: nonthrowing_boundary_container_adaptor.h:344
auto inplace_subtract(Iterator_t &cursor, const Element_t &start, const Element_t &exclusive_end) noexcept
Subtract the given interval, reading and updating the given cursor.
Definition: nonthrowing_boundary_container_adaptor.h:279
static auto lower_bound_impl(mysql::meta::Is_same_ignore_const< This_t > auto &self, const auto &cursor, const Element_t &element) noexcept
Return iterator to the leftmost boundary at or after cursor that is greater than or equal to the give...
Definition: nonthrowing_boundary_container_adaptor.h:361
static auto upper_bound_impl(mysql::meta::Is_same_ignore_const< This_t > auto &self, const auto &cursor, const Element_t &element) noexcept
Return iterator to the leftmost boundary at or after cursor that is greater than the given element.
Definition: nonthrowing_boundary_container_adaptor.h:352
auto inplace_union(Input_set_t &&input_set) noexcept
In-place insert the intervals of the given set into this container (inplace union).
Definition: nonthrowing_boundary_container_adaptor.h:228
auto insert(const Element_t &element) noexcept
Insert the given element (inplace union).
Definition: nonthrowing_boundary_container_adaptor.h:122
Throwing_boundary_container_t::Storage_t Storage_t
Definition: nonthrowing_boundary_container_adaptor.h:65
auto inplace_subtract(Input_set_t &&input_set) noexcept
In-place subtract intervals of the given container from this container.
Definition: nonthrowing_boundary_container_adaptor.h:303
auto inplace_subtract(const Element_t &start, const Element_t &exclusive_end) noexcept
Subtract the given interval.
Definition: nonthrowing_boundary_container_adaptor.h:251
auto inplace_union(const Element_t &start, const Element_t &exclusive_end) noexcept
Insert the given interval (inplace union).
Definition: nonthrowing_boundary_container_adaptor.h:156
Iterator_tp Iterator_t
Definition: boundary_set_interface.h:75
Set_traits_tp Set_traits_t
Definition: boundary_set_interface.h:78
typename Set_traits_tp::Element_t Element_t
Definition: boundary_set_interface.h:79
Const_iterator_tp Const_iterator_t
Definition: boundary_set_interface.h:76
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:180
Class that wraps resources in a polymorphic manner.
std::remove_cvref_t< decltype(std::declval< const Range_t >().begin())> Range_const_iterator_type
Gives the const_iterator type, deduced from the begin() const member.
Definition: meta.h:47
std::remove_cvref_t< decltype(std::declval< Range_t >().begin())> Range_iterator_type
Gives the iterator type, deduced from the begin() member.
Definition: meta.h:42
Definition: gtid_set.h:183
noexcept
The return type for any call_and_catch(f, args...) call where f(args...) returns Type.
Definition: call_and_catch.h:76