OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::basic_string_span< C, P, S > Class Template Reference

Specialization of memory::basic_span for character string containers. More...

#include <eagine/string_span.hpp>

Public Types

using string_type = std::basic_string< std::remove_const_t< C > >
 Related standard string type.
 
using std_view_type = std::basic_string_view< std::remove_const_t< C > >
 Related standard string view type.
 
- Public Types inherited from eagine::memory::basic_span< C, C *, span_size_t >
using value_type = C
 The element value type.
 
using size_type = span_size_t
 The element count type.
 
using address_type = basic_address< std::is_const_v< C > >
 The memory address type.
 
using pointer = C *
 The pointer type.
 
using iterator = C *
 The iterator type.
 
using const_iterator = C *
 The const iterator type.
 
using reverse_iterator = std::reverse_iterator< iterator >
 The reverse iterator type.
 

Public Member Functions

constexpr basic_string_span () noexcept=default
 Default constructor. More...
 
template<std::size_t N>
constexpr basic_string_span (C(&array)[N]) noexcept
 Construction from C string literal.
 
template<std::size_t N>
constexpr basic_string_span (C(&array)[N], span_size_t n) noexcept
 Construction from C-array and explicit length value.
 
constexpr basic_string_span (const string_type &str) noexcept
 Construction from related standard string type.
 
template<typename Str , typename = std::enable_if_t< memory::has_span_data_member_v<Str, C> && memory::has_span_size_member_v<Str>>>
constexpr basic_string_span (Str &str) noexcept
 Construction from compatible container reference. More...
 
template<typename Str , typename = std::enable_if_t< memory::has_span_data_member_v<Str, C> && memory::has_span_size_member_v<Str>>>
constexpr basic_string_span (const Str &str) noexcept
 Construction from compatible container const reference. More...
 
constexpr auto std_view () const noexcept -> std_view_type
 Named conversion to the corresponding standard string view.
 
constexpr operator std_view_type () const noexcept
 Implicit conversion to the corresponding standard string view.
 
constexpr auto to_string () const -> string_type
 Conversion to the corresponding standard string.
 
constexpr auto data () const noexcept -> pointer
 Returns a pointer to the start of the span. More...
 
constexpr auto empty () const noexcept -> bool
 Indicates that the span is empty. More...
 
constexpr auto size () const noexcept -> size_type
 Returns the number of elements in the span. More...
 
- Public Member Functions inherited from eagine::memory::basic_span< C, C *, span_size_t >
constexpr basic_span (pointer addr, size_type len) noexcept
 Construction from pointer and length.
 
constexpr basic_span (address_type addr, size_type len) noexcept
 Construction from memory address and length.
 
constexpr basic_span (pointer b, pointer e) noexcept
 Construction from a pair of pointers.
 
constexpr basic_span (address_type ba, address_type be) noexcept
 Construction from a pair of memory addresses.
 
constexpr basic_span () noexcept=default
 Default constructor. Constructs an empty span. More...
 
constexpr basic_span (const basic_span &) noexcept=default
 Copy constructor.
 
constexpr basic_span (basic_span &&) noexcept=default
 Move constructor.
 
constexpr basic_span (basic_span< T, P, S > that) noexcept
 Converting copy constructor from span of compatible elements.
 
auto operator= (const basic_span &) noexcept -> basic_span &=default
 Copy assignment operator.
 
auto operator= (basic_span &&) noexcept -> basic_span &=default
 Move assignment operator.
 
auto operator= (basic_span< T, P, S > that) noexcept -> auto &
 Converting copy assignment from span of compatible elements.
 
auto reset () noexcept -> auto &
 Resets this span. More...
 
auto reset (pointer addr, size_type length) noexcept -> auto &
 Resets this span with a new pointer and length.
 
auto reset (address_type addr, size_type length) noexcept -> auto &
 Resets this span with a new memory address and length.
 
auto reset (pointer b, pointer e) noexcept -> auto &
 Resets this span with a pair or pointers.
 
constexpr operator bool () const noexcept
 Indicates that the span is not empty. More...
 
constexpr auto is_empty () const noexcept -> bool
 Indicates that the span is empty. More...
 
constexpr auto empty () const noexcept -> bool
 Indicates that the span is empty. More...
 
constexpr auto is_zero_terminated () const noexcept -> bool
 Indicates that the span is terminated with value T(0) if applicable.
 
constexpr auto size () const noexcept -> size_type
 Returns the number of elements in the span. More...
 
constexpr auto data () const noexcept -> pointer
 Returns a pointer to the start of the span. More...
 
constexpr auto begin () const noexcept -> iterator
 Returns an interator to the start of the span.
 
constexpr auto end () const noexcept -> iterator
 Returns a iterator past the end of the span.
 
constexpr auto rbegin () const noexcept
 Returns a reverse interator to the end of the span.
 
constexpr auto rend () const noexcept
 Returns a reverse interator past the begin of the span.
 
constexpr auto addr () const noexcept -> address_type
 Returns the memory address of the start of the span.
 
constexpr auto begin_addr () const noexcept -> address_type
 Returns the memory address of the start of the span.
 
constexpr auto end_addr () const noexcept -> address_type
 Returns the memory address past the end of the span.
 
auto is_aligned_as () const noexcept -> bool
 Checks if the start of the span is aligned as the alignment of X.
 
auto encloses (const_address a) const noexcept -> bool
 Indicates if this span encloses the specified address. More...
 
auto contains (basic_span< Ts, Ps, Ss > that) const noexcept -> bool
 Indicates if this span encloses another span. More...
 
auto overlaps (const basic_span< Ts, Ps, Ss > &that) const noexcept -> bool
 Indicates if this span overlaps with another span. More...
 
constexpr auto ref (size_type index) const noexcept -> std::add_const_t< value_type > &
 Returns a const reference to value at the specified index. More...
 
auto ref (size_type index) noexcept -> value_type &
 Returns a reference to value at the specified index. More...
 
auto front () const noexcept -> const value_type &
 Returns a const reference to value at the front of the span. More...
 
auto front () noexcept -> value_type &
 Returns a reference to value at the front of the span. More...
 
auto back () const noexcept -> const value_type &
 Returns a const reference to value at the back of the span. More...
 
auto back () noexcept -> value_type &
 Returns a const reference to value at the back of the span. More...
 
constexpr auto element (Int index) const noexcept -> std::enable_if_t< std::is_integral_v< Int >, std::add_const_t< value_type > & >
 Returns a const reference to value at the specified index. More...
 
auto element (Int index) noexcept -> std::enable_if_t< std::is_integral_v< Int >, value_type & >
 Returns a reference to value at the specified index. More...
 
auto operator[] (Int index) noexcept -> std::enable_if_t< std::is_integral_v< Int >, value_type & >
 Array subscript operator. More...
 
constexpr auto operator[] (Int index) const noexcept -> std::enable_if_t< std::is_integral_v< Int >, std::add_const_t< value_type > & >
 Array subscript operator. More...
 

Additional Inherited Members

Detailed Description

template<typename C, typename P = C*, typename S = span_size_t>
class eagine::basic_string_span< C, P, S >

Specialization of memory::basic_span for character string containers.

Constructor & Destructor Documentation

◆ basic_string_span() [1/3]

template<typename C , typename P = C*, typename S = span_size_t>
constexpr eagine::basic_string_span< C, P, S >::basic_string_span ( )
constexprdefaultnoexcept

Default constructor.

Postcondition
empty

◆ basic_string_span() [2/3]

template<typename C , typename P = C*, typename S = span_size_t>
template<typename Str , typename = std::enable_if_t< memory::has_span_data_member_v<Str, C> && memory::has_span_size_member_v<Str>>>
constexpr eagine::basic_string_span< C, P, S >::basic_string_span ( Str &  str)
inlineconstexprnoexcept

Construction from compatible container reference.

The container passed as argument should have data and size member functions with the same semantics as std::string does.

◆ basic_string_span() [3/3]

template<typename C , typename P = C*, typename S = span_size_t>
template<typename Str , typename = std::enable_if_t< memory::has_span_data_member_v<Str, C> && memory::has_span_size_member_v<Str>>>
constexpr eagine::basic_string_span< C, P, S >::basic_string_span ( const Str &  str)
inlineconstexprnoexcept

Construction from compatible container const reference.

The container passed as argument should have data and size member functions with the same semantics as std::string does.

Member Function Documentation

◆ data()

template<typename C , typename P = C*, typename S = span_size_t>
constexpr auto eagine::memory::basic_span< ValueType, Pointer, SizeType >::data
inlineconstexprnoexcept

Returns a pointer to the start of the span.

See also
begin
end
size

◆ empty()

template<typename C , typename P = C*, typename S = span_size_t>
constexpr auto eagine::memory::basic_span< ValueType, Pointer, SizeType >::empty
inlineconstexprnoexcept

Indicates that the span is empty.

See also
is_empty
size

◆ size()

template<typename C , typename P = C*, typename S = span_size_t>
constexpr auto eagine::memory::basic_span< ValueType, Pointer, SizeType >::size
inlineconstexprnoexcept

Returns the number of elements in the span.

See also
is_empty

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

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).