24#ifndef MYSQL_SETS_THROWING_VECTOR_BOUNDARY_STORAGE_H
25#define MYSQL_SETS_THROWING_VECTOR_BOUNDARY_STORAGE_H
50template <
class Vector_iterator_tp,
class Mutable_vector_iterator_tp =
void>
53 Vector_iterator_tp, Mutable_vector_iterator_tp>> {
71 requires(!std::same_as<Mutable_vector_iterator_t, void>)
83 if ((delta & 1) != 0) {
110template <Is_bounded_set_traits Set_traits_t>
128template <Is_bounded_set_traits Set_traits_tp>
131 Vector_boundary_storage<Set_traits_tp>,
132 detail::Vector_for_set_traits<Set_traits_tp>>,
134 Vector_boundary_storage<Set_traits_tp>, Set_traits_tp,
135 mysql::ranges::Range_iterator_type<
136 detail::Vector_for_set_traits<Set_traits_tp>>,
137 mysql::ranges::Range_const_iterator_type<
138 detail::Vector_for_set_traits<Set_traits_tp>>,
139 Iterator_get_value> {
151 using Vector_t = std::vector<Element_t, Allocator_t>;
156 static_assert(std::contiguous_iterator<Iterator_t>);
166 std::same_as<Vector_t, detail::Vector_for_set_traits<Set_traits_t>>);
193 template <std::input_iterator First_iterator_t>
195 const First_iterator_t &first,
196 const std::sentinel_for<First_iterator_t>
auto &last,
226 [[nodiscard]]
auto end()
const {
237 [[nodiscard]] std::size_t
size()
const {
return vector().size(); }
243 [[nodiscard]]
explicit operator bool()
const {
return (
bool)
vector(); }
246 template <
class Iter_t>
250 return std::upper_bound(hint,
self.
end(), element,
Less_t());
254 template <
class Iter_t>
258 return std::lower_bound(hint,
self.
end(), element,
Less_t());
276 bool is_endpoint =
left.is_endpoint();
295 assert(position ==
begin() ||
lt(*std::prev(position), v1));
297 assert(position ==
end() ||
lt(v2, *position));
309 return std::next(position);
Allocator using a Memory_resource to do the allocation.
Definition: allocator.h:52
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 get_memory_resource() const noexcept
Return the memory resource used by the wrapped object.
Definition: basic_container_wrapper.h:137
auto assign(const First_iterator_t &first, const Sentinel_t &last) noexcept(mysql::utils::Shall_catch::no==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.
Definition: basic_container_wrapper.h:83
auto & wrapped() &noexcept
Definition: basic_container_wrapper.h:183
CRTP base class (mixin) that makes your class a standard-compliant iterator, given only a minimal set...
Definition: iterator_interface.h:370
CRTP base class (mixin) to define a set that has upper_bound and lower_bound members.
Definition: upper_lower_bound_interface.h:193
Storage for boundary points, backed by std::vector.
Definition: vector_boundary_storage.h:139
Vector_boundary_storage(const First_iterator_t &first, const std::sentinel_for< First_iterator_t > auto &last, const Memory_resource_t &memory_resource=Memory_resource_t())
Constructor copying a range defined by the given iterators, using memory_resource if given,...
Definition: vector_boundary_storage.h:194
auto begin() const
Definition: vector_boundary_storage.h:221
Set_traits_t::Element_t Element_t
Definition: vector_boundary_storage.h:145
auto begin()
Definition: vector_boundary_storage.h:231
static Iter_t upper_bound_impl(mysql::meta::Is_same_ignore_const< This_t > auto &self, const Iter_t &hint, const Element_t &element)
Definition: vector_boundary_storage.h:247
Vector_boundary_storage(const Is_readable_boundary_storage_over_traits< Set_traits_t > auto &source, const Memory_resource_t &memory_resource)
Constructor copying from another type, using the given Memory_resource.
Definition: vector_boundary_storage.h:185
Vector_t::const_iterator Vector_const_iterator_t
Definition: vector_boundary_storage.h:153
auto end()
Definition: vector_boundary_storage.h:234
Vector_boundary_storage(const Is_readable_boundary_storage_over_traits< Set_traits_t > auto &source)
Constructor copying both values and Memory_resource from another storage.
Definition: vector_boundary_storage.h:179
const Vector_t & vector() const
Definition: vector_boundary_storage.h:218
static Iter_t lower_bound_impl(mysql::meta::Is_same_ignore_const< This_t > auto &self, const Iter_t &hint, const Element_t &element)
Return the lower bound for the given element in the given storage.
Definition: vector_boundary_storage.h:255
Vector_boundary_storage(Vector_boundary_storage &&) noexcept=default
Vector_t & vector()
Definition: vector_boundary_storage.h:217
detail::Vector_boundary_iterator< Vector_const_iterator_t > Const_iterator_t
Definition: vector_boundary_storage.h:160
auto end() const
Definition: vector_boundary_storage.h:226
bool empty() const
Definition: vector_boundary_storage.h:240
Vector_boundary_storage(const Memory_resource_t &memory_resource=Memory_resource_t()) noexcept
Construct a new, empty object, with the given Memory_resource.
Definition: vector_boundary_storage.h:172
Iterator_t erase(const Iterator_t &left, const Iterator_t &right)
Erase an even-length range of boundary points.
Definition: vector_boundary_storage.h:273
mysql::allocators::Memory_resource Memory_resource_t
Definition: vector_boundary_storage.h:148
static constexpr bool lt(const Element_t &left, const Element_t &right)
Return true if "left < right", according to the order defined by Set_traits_t.
Definition: vector_boundary_storage.h:315
Iterator_t update_point(const Iterator_t &position, const Element_t &element)
Modify the element that the iterator points to.
Definition: vector_boundary_storage.h:306
Set_traits_tp Set_traits_t
Definition: vector_boundary_storage.h:143
static constexpr bool has_fast_insertion
Declare that insertion is "slow", i.e., O(N).
Definition: vector_boundary_storage.h:169
Set_traits_t::Less_t Less_t
Definition: vector_boundary_storage.h:146
Iterator_t insert(const Iterator_t &position, const Element_t &v1, const Element_t &v2)
Insert two boundary points.
Definition: vector_boundary_storage.h:293
std::vector< Element_t, Allocator_t > Vector_t
Definition: vector_boundary_storage.h:151
std::size_t size() const
Definition: vector_boundary_storage.h:237
static constexpr bool le(const Element_t &left, const Element_t &right)
Return true if "left <= right", according to the order defined by Set_traits_t.
Definition: vector_boundary_storage.h:322
Vector_boundary_storage(const Vector_boundary_storage &)=default
detail::Vector_boundary_iterator< Vector_iterator_t > Iterator_t
Definition: vector_boundary_storage.h:154
Vector_t::iterator Vector_iterator_t
Definition: vector_boundary_storage.h:152
Boundary_iterator based on a std::vector iterator or const iterator.
Definition: vector_boundary_storage.h:53
Vector_iterator_tp Vector_iterator_t
Definition: vector_boundary_storage.h:54
Vector_boundary_iterator(const Vector_iterator_t &position, bool is_endpoint)
Construct an iterator at the given position, and at the given endpoint state.
Definition: vector_boundary_storage.h:64
Vector_iterator_t m_position
Iterator to the underlying vector.
Definition: vector_boundary_storage.h:104
auto * get_pointer() const
Definition: vector_boundary_storage.h:76
Vector_boundary_iterator()=default
Default constructor.
Mutable_vector_iterator_tp Mutable_vector_iterator_t
Definition: vector_boundary_storage.h:55
Vector_boundary_iterator(const Vector_boundary_iterator< Mutable_vector_iterator_t > &other)
Converting constructor from the mutable iterator type, enabled if this is a const iterator.
Definition: vector_boundary_storage.h:69
std::ptrdiff_t distance_from(const Vector_boundary_iterator &other) const
Definition: vector_boundary_storage.h:89
bool is_endpoint() const
Definition: vector_boundary_storage.h:95
bool m_is_endpoint
True if the current boundary is an endpoint.
Definition: vector_boundary_storage.h:107
const Vector_iterator_t & vector_iterator() const
Definition: vector_boundary_storage.h:98
void advance(std::ptrdiff_t delta)
Move forward the given number of steps.
Definition: vector_boundary_storage.h:81
True if the iterator is declared to meet LegacyBidirectionalIterator requirements.
Definition: meta.h:83
True if Test is a readable boundary storage, i.e., an object that can be used as the back-end storage...
Definition: boundary_set_meta.h:342
True if Test is a boundary storage over the given Set traits.
Definition: boundary_set_meta.h:313
Allocator class that uses a polymorphic Memory_resource to allocate memory.
Class that wraps resources in a polymorphic manner.
bool distance(const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, double *distance, bool *is_null) noexcept
Computes the distance between two geometries.
Definition: distance.cc:40
void right(std::string *to_trim)
Definition: trim.h:41
void left(std::string *to_trim)
Definition: trim.h:35
std::vector< typename Set_traits_t::Element_t, mysql::allocators::Allocator< typename Set_traits_t::Element_t > > Vector_for_set_traits
Definition: vector_boundary_storage.h:113
noexcept
The return type for any call_and_catch(f, args...) call where f(args...) returns Type.
Definition: call_and_catch.h:76
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2880
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:42