Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::const_inline_string_reference Class Reference

A const reference class to an inline_string object, with size-erased type. More...

Inheritance diagram for arene::base::const_inline_string_reference:
Inheritance graph

Public Types

using const_iterator = string_base::const_iterator
 The type of a const iterator at the base class.
 
using size_type = string_base::size_type
 The type of a size at the base class.
 
using string_base = inline_string_detail::inline_string_base
 The type of the base class.
 

Public Member Functions

template<std::size_t MaxSize>
constexpr const_inline_string_reference (inline_string< MaxSize > const &str) noexcept
 Construct a const reference to the supplied inline_string.
 
constexpr const_inline_string_reference (inline_string_reference const &ref) noexcept
 Construct a const reference out of a non-const one.
 
template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
constexpr auto at (size_type const index) const -> detail::character const &
 Retrieve the index -th character in the string.
 
constexpr auto back () const noexcept -> detail::character const &
 Get the last character in the string.
 
constexpr auto begin () const noexcept -> const_iterator
 Return an iterator to the first position in the string.
 
ARENE_NODISCARD constexpr auto c_str () const noexcept -> detail::raw_c_string
 Return a pointer to the NUL-terminated string held in *this.
 
constexpr auto capacity () const noexcept -> size_type
 The maximum length of the string.
 
ARENE_NODISCARD constexpr auto data () const noexcept -> detail::raw_c_string
 Return a pointer to the NUL-terminated string held in *this.
 
constexpr auto empty () const noexcept -> bool
 Check if the string is empty.
 
constexpr auto end () const noexcept -> const_iterator
 The one-past-the-last position in the string.
 
constexpr auto front () const noexcept -> detail::character const &
 Get the first character in the string.
 
ARENE_NODISCARD constexpr auto operator[] (size_type const index) const noexcept -> detail::character const &
 Retrieve the index -th character in the string.
 
constexpr auto size () const noexcept -> size_type
 Get the length of the string.
 
constexpr auto to_string_view () const noexcept -> string_view
 Convert to string view.
 

Static Public Member Functions

static ARENE_NODISCARD constexpr auto three_way_compare (const_inline_string_reference const lhs, const_inline_string_reference const rhs) noexcept -> strong_ordering
 Compare two strings for lexicographical ordering, forwarded to string_view's.
 
static ARENE_NODISCARD constexpr auto three_way_compare (const_inline_string_reference const lhs, inline_string_reference const rhs) noexcept -> strong_ordering
 Compare two strings for lexicographical ordering, forwarded to string_view's.
 
static ARENE_NODISCARD constexpr auto three_way_compare (const_inline_string_reference const lhs, string_view const rhs) noexcept -> strong_ordering
 Compare two strings for lexicographical ordering, forwarded to string_view's.
 

Detailed Description

A const reference class to an inline_string object, with size-erased type.

Member Typedef Documentation

◆ const_iterator

The type of a const iterator at the base class.

◆ size_type

The type of a size at the base class.

◆ string_base

using arene::base::const_inline_string_reference::string_base = inline_string_detail::inline_string_base

The type of the base class.

Constructor & Destructor Documentation

◆ const_inline_string_reference() [1/2]

template<std::size_t MaxSize>
arene::base::const_inline_string_reference::const_inline_string_reference ( inline_string< MaxSize > const & str)
inlineexplicitconstexprnoexcept

Construct a const reference to the supplied inline_string.

Template Parameters
MaxSizeThe maximum capacity of the string, not including the null terminator
Parameters
strConst reference to the inline_string

◆ const_inline_string_reference() [2/2]

arene::base::const_inline_string_reference::const_inline_string_reference ( inline_string_reference const & ref)
inlineexplicitconstexprnoexcept

Construct a const reference out of a non-const one.

Parameters
refThe non-const reference class

Member Function Documentation

◆ at()

template<bool AreExceptionsEnabled = detail::are_exceptions_enabled::value, constraints< std::enable_if_t< AreExceptionsEnabled > > = nullptr>
auto arene::base::const_inline_string_reference::at ( size_type const index) const -> detail::character const&
inlineconstexpr

Retrieve the index -th character in the string.

Template Parameters
AreExceptionsEnabledUsed to disable this overload if exceptions are not enabled.
Parameters
indexThe index of the character to retrieve
Returns
A reference to that character

◆ back()

auto arene::base::const_inline_string_reference::back ( ) const -> detail::character const&
inlineconstexprnoexcept

Get the last character in the string.

Returns
A reference to the last character

◆ begin()

auto arene::base::const_inline_string_reference::begin ( ) const -> const_iterator
inlineconstexprnoexcept

Return an iterator to the first position in the string.

Returns
A const iterator to the first element if not empty, end() otherwise

◆ c_str()

ARENE_NODISCARD constexpr auto arene::base::const_inline_string_reference::c_str ( ) const -> detail::raw_c_string
inlineconstexprnoexcept

Return a pointer to the NUL-terminated string held in *this.

Returns
A pointer to the NUL-terminated string held in *this

◆ capacity()

auto arene::base::const_inline_string_reference::capacity ( ) const -> size_type
inlineconstexprnoexcept

The maximum length of the string.

Returns
size_type MaxSize

◆ data()

ARENE_NODISCARD constexpr auto arene::base::const_inline_string_reference::data ( ) const -> detail::raw_c_string
inlineconstexprnoexcept

Return a pointer to the NUL-terminated string held in *this.

Returns
A pointer to the NUL-terminated string held in *this

◆ empty()

auto arene::base::const_inline_string_reference::empty ( ) const -> bool
inlineconstexprnoexcept

Check if the string is empty.

Returns
true if the string is empty, false otherwise

◆ end()

auto arene::base::const_inline_string_reference::end ( ) const -> const_iterator
inlineconstexprnoexcept

The one-past-the-last position in the string.

Returns
A const iterator to one-past-the-last position in the string

◆ front()

auto arene::base::const_inline_string_reference::front ( ) const -> detail::character const&
inlineconstexprnoexcept

Get the first character in the string.

Returns
A reference to the first character

◆ operator[]()

ARENE_NODISCARD constexpr auto arene::base::const_inline_string_reference::operator[] ( size_type const index) const -> detail::character const&
inlineconstexprnoexcept

Retrieve the index -th character in the string.

Parameters
indexThe index of the character to retrieve
Returns
A reference to that character

◆ size()

auto arene::base::const_inline_string_reference::size ( ) const -> size_type
inlineconstexprnoexcept

Get the length of the string.

Returns
The number of characters in the string, non-inclusive of the null-terminator

◆ three_way_compare() [1/3]

static ARENE_NODISCARD constexpr auto arene::base::const_inline_string_reference::three_way_compare ( const_inline_string_reference const lhs,
const_inline_string_reference const rhs ) -> strong_ordering
inlinestaticconstexprnoexcept

Compare two strings for lexicographical ordering, forwarded to string_view's.

Parameters
lhsThe first string representation
rhsThe second string representation
Returns
strong_ordering equivalent to string_view's 3 way compare result

◆ three_way_compare() [2/3]

static ARENE_NODISCARD constexpr auto arene::base::const_inline_string_reference::three_way_compare ( const_inline_string_reference const lhs,
inline_string_reference const rhs ) -> strong_ordering
inlinestaticconstexprnoexcept

Compare two strings for lexicographical ordering, forwarded to string_view's.

Parameters
lhsThe first string representation
rhsThe second string representation
Returns
strong_ordering equivalent to string_view's 3 way compare result

◆ three_way_compare() [3/3]

static ARENE_NODISCARD constexpr auto arene::base::const_inline_string_reference::three_way_compare ( const_inline_string_reference const lhs,
string_view const rhs ) -> strong_ordering
inlinestaticconstexprnoexcept

Compare two strings for lexicographical ordering, forwarded to string_view's.

Parameters
lhsThe first string representation
rhsThe second string representation
Returns
strong_ordering equivalent to string_view's 3 way compare result

◆ to_string_view()

auto arene::base::const_inline_string_reference::to_string_view ( ) const -> string_view
inlineconstexprnoexcept

Convert to string view.

Returns
string_view A string_view object referencing the data

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