MySQL 9.6.0
Source Code Documentation
mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch > Class Template Reference

CRTP base class (mixin) to define a wrapper around a container. More...

#include <basic_container_wrapper.h>

Inheritance diagram for mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >:
[legend]

Public Types

using Wrapped_t = Wrapped_tp
 

Public Member Functions

template<class... Args_t>
requires mysql::meta::Not_decayed<This_t, Args_t...>
 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...
 
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...
 
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 end () noexcept
 
auto begin () const 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...
 

Protected Member Functions

auto & wrapped () &noexcept
 
const auto & wrapped () const &noexcept
 
auto && wrapped () &&noexcept
 

Private Types

using Self_t = Self_tp
 
using This_t = Basic_container_wrapper< Self_t, Wrapped_tp, shall_catch >
 

Private Member Functions

auto & self () noexcept
 Return a non-const reference to the subclass. More...
 
const auto & self () const noexcept
 Return a const reference to the subclass. More...
 

Private Attributes

Wrapped_t m_wrapped
 Wrapped object. More...
 

Detailed Description

template<class Self_tp, class Wrapped_tp, mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
class mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >

CRTP base class (mixin) to define a wrapper around a container.

This defines the clear and assign member modifiers based on the wrapped container, as well as get_memory_resource and all the Collection_interface members.

Template Parameters
Self_tpThe wrapper class that inherits from this class.
Wrapped_tpThe wrapped class.
shall_catchIf yes, assign will use mysql::utils::call_and_catch to convert exceptions to return values.

Member Typedef Documentation

◆ Self_t

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
using mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::Self_t = Self_tp
private

◆ This_t

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
using mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::This_t = Basic_container_wrapper<Self_t, Wrapped_tp, shall_catch>
private

◆ Wrapped_t

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
using mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::Wrapped_t = Wrapped_tp

Constructor & Destructor Documentation

◆ Basic_container_wrapper()

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
template<class... Args_t>
requires mysql::meta::Not_decayed<This_t, Args_t...>
mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::Basic_container_wrapper ( Args_t &&...  args)
inlineexplicitnoexcept

Constructor that delegates all parameters to the constructor of the wrapped class.

Member Function Documentation

◆ assign() [1/3]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
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 mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::assign ( const First_iterator_t &  first,
const Sentinel_t &  last 
)
inlinenoexcept

Assign a range defined by the two iterators to the wrapped object.

This is enabled provided that the wrapped class defines an assign member taking two iterators.

◆ assign() [2/3]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
template<class Other_t >
auto mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::assign ( const Other_t &  other)
inlinenoexcept

Copy-assign the other object to the wrapped object.

This is enabled provided that the subclass defines an assign member taking two iterators.

◆ assign() [3/3]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
void mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::assign ( Self_t &&  other)
inlinenoexcept

Move-assign the other object to the wrapped object.

This is enabled provided that the wrapped class is nothrow-move-assignable.

◆ begin() [1/2]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::begin ( ) const
inlinenoexcept
Returns
const iterator to the first element

◆ begin() [2/2]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::begin ( )
inlinenoexcept
Returns
iterator to the first element

◆ clear()

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
void mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::clear ( )
inlinenoexcept

Clear the wrapped object.

This invokes the clear member of the wrapped object.

◆ empty()

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::empty ( ) const
inlinenoexcept
Returns
const iterator to the first element

◆ end() [1/2]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::end ( ) const
inlinenoexcept
Returns
const iterator to one-after-last element

◆ end() [2/2]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::end ( )
inlinenoexcept
Returns
iterator to one-after-last element

◆ get_allocator()

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::get_allocator ( ) const
inlinenoexcept

Return the allocator used by the wrapped object.

This invokes the get_allocator member of the wrapped object, if it exists. Otherwise, this member cannot be used.

◆ get_memory_resource()

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::get_memory_resource ( ) const
inlinenoexcept

Return the memory resource used by the wrapped object.

This invokes the get_memory_resource member of the wrapped object, if it exists; otherwise invokes the get_memory_resource member of the object returned by the get_allocator member of the wrapped object, if both those exists. If none of these two is possible, this member cannot be used.

◆ self() [1/2]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
const auto & mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::self ( ) const
inlineprivatenoexcept

Return a const reference to the subclass.

◆ self() [2/2]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto & mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::self ( )
inlineprivatenoexcept

Return a non-const reference to the subclass.

◆ size()

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::size ( ) const
inlinenoexcept
Returns
const iterator to one-after-last element

◆ wrapped() [1/3]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto && mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::wrapped ( ) &&
inlineprotectednoexcept
Returns
rvalue reference to the wrapped object.

◆ wrapped() [2/3]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
auto & mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::wrapped ( ) &
inlineprotectednoexcept
Returns
non-const lvalue reference to the wrapped object.

◆ wrapped() [3/3]

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
const auto & mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::wrapped ( ) const &
inlineprotectednoexcept
Returns
const lvalue reference to the wrapped object.

Member Data Documentation

◆ m_wrapped

template<class Self_tp , class Wrapped_tp , mysql::utils::Shall_catch shall_catch = mysql::utils::Shall_catch::no>
Wrapped_t mysql::containers::Basic_container_wrapper< Self_tp, Wrapped_tp, shall_catch >::m_wrapped
private

Wrapped object.


The documentation for this class was generated from the following file: