template <std::size_t N>
rll::fixed_string struct

Fixed size string class.

Template parameters
N The maximum number of characters the fixed_string can hold.

fixed_string is a template class that encapsulates a string of a fixed number of characters. It is designed to be used where strings are needed as non-type template parameters.

Public types

using const_iterator = const_pointer
Type of constant iterator for traversing the string.
using const_pointer = char const *
Type of constant pointer to the string data.
using const_reference = char const &
Type of constant reference to a character in the string.
using const_reverse_iterator = std::reverse_iterator<const_iterator>
Type of constant reverse iterator for traversing the string in reverse.
using value_type = char
Type of character in a string.

Public static variables

static auto max_length constexpr

Constructors, destructors, conversion operators

fixed_string() defaulted constexpr noexcept
Default constructor.
template <typename T>
fixed_string(T const (&data)[N+1]) constexpr noexcept(…)
Constructs a fixed_string from a character array.
template <typename T>
fixed_string(T const (&data)[N+1], bool& error) constexpr noexcept
Constructs a fixed_string from a character array.

Public functions

auto at(std::size_t n) const →  const_reference constexpr noexcept
Accesses the character at the specified location with bounds checking.
auto back() const →  const_reference constexpr noexcept
Accesses the last element.
auto begin() const →  const_iterator constexpr noexcept
Retrieves the begin iterator of the fixed_string.
auto capacity() const →  size_t constexpr noexcept
Retrieves the capacity of the fixed_string.
auto cbegin() const →  const_iterator constexpr noexcept
Retrieves the constant begin iterator of the fixed_string.
auto cend() const →  const_iterator constexpr noexcept
Retrieves the constant end iterator of the fixed_string.
template <size_t N2>
auto compare(fixed_string<N2> const& rhs) const →  int constexpr noexcept
Compares the string with another fixed_string.
auto crbegin() const →  const_reverse_iterator constexpr noexcept
Retrieves the constant reverse begin iterator of the fixed_string.
auto crend() const →  const_reverse_iterator constexpr noexcept
Retrieves the constant reverse end iterator of the fixed_string.
auto data() const →  const_pointer constexpr noexcept
Provides a pointer to the underlying data.
auto empty() const →  bool constexpr noexcept
Checks if the fixed_string is empty.
auto end() const →  const_iterator constexpr noexcept
Retrieves the end iterator of the fixed_string.
auto front() const →  const_reference constexpr noexcept
Accesses the first element.
auto hash() const →  std::size_t constexpr noexcept
Calculates the hash of the string.
auto operator[](std::size_t const n) const →  const_reference constexpr noexcept
Accesses the character at the specified location with bounds checking.
auto rbegin() const →  const_reverse_iterator constexpr noexcept
Retrieves the reverse begin iterator of the fixed_string.
auto rend() const →  const_reverse_iterator constexpr noexcept
Retrieves the reverse end iterator of the fixed_string.
auto size() const →  size_t constexpr noexcept
Retrieves the size of the fixed_string.
void swap(fixed_string& other) constexpr noexcept
Swaps the contents with another fixed_string.

Public variables

size_t length
char _data

Function documentation

template <std::size_t N>
rll::fixed_string::fixed_string() defaulted constexpr noexcept

Default constructor.

Constructs a fixed_string with default values, initializing the string with null characters.

template <std::size_t N>
template <typename T>
rll::fixed_string::fixed_string(T const (&data)[N+1]) constexpr noexcept(…)

Constructs a fixed_string from a character array.

Template parameters
T The character type of the input array.
Parameters
data in The character array to initialize the fixed_string with.
Exceptions
parse_error Thrown if contains unexpected characters for addresses

This constructor template initializes a fixed_string with the contents of a given character array.

template <std::size_t N>
template <typename T>
rll::fixed_string::fixed_string(T const (&data)[N+1], bool& error) constexpr noexcept

Constructs a fixed_string from a character array.

Template parameters
T The character type of the input array.
Parameters
data in The character array to initialize the fixed_string with.
error out A reference to an bool object that will be set to true if an error occurs during parsing.

This constructor template initializes a fixed_string with the contents of a given character array.

template <std::size_t N>
const_reference rll::fixed_string::at(std::size_t n) const constexpr noexcept

Accesses the character at the specified location with bounds checking.

Parameters
in The position of the character to return.
Returns A reference to the character at the specified location.
Exceptions
std::out_of_range When going beyond the bounds of the character array.

Returns a reference to the character at the specified location n. If n is out of bounds, an exception of type std::out_of_range will be thrown.

template <std::size_t N>
const_reference rll::fixed_string::back() const constexpr noexcept

Accesses the last element.

Returns Reference to the last element.

Provides a reference to the last element in the string. Undefined behavior occurs if this function is called on an empty string.

template <std::size_t N>
const_iterator rll::fixed_string::begin() const constexpr noexcept

Retrieves the begin iterator of the fixed_string.

Returns A constant iterator to the beginning of the fixed_string.

Returns an iterator pointing to the first character of the fixed_string. If the fixed_string is empty, the returned iterator will be equal to the one returned by end().

template <std::size_t N>
size_t rll::fixed_string::capacity() const constexpr noexcept

Retrieves the capacity of the fixed_string.

Returns The capacity of the fixed_string.

Returns the total number of characters that the fixed_string can hold.

template <std::size_t N>
const_iterator rll::fixed_string::cbegin() const constexpr noexcept

Retrieves the constant begin iterator of the fixed_string.

Returns A constant iterator to the beginning of the fixed_string.

Returns a constant iterator pointing to the first character of the fixed_string. If the fixed_string is empty, the returned iterator will be equal to cend().

template <std::size_t N>
const_iterator rll::fixed_string::cend() const constexpr noexcept

Retrieves the constant end iterator of the fixed_string.

Returns A constant iterator to the end of the fixed_string.

Returns a constant iterator pointing to the past-the-end character of the fixed_string. This iterator acts as a placeholder and should not be dereferenced.

template <std::size_t N>
template <size_t N2>
int rll::fixed_string::compare(fixed_string<N2> const& rhs) const constexpr noexcept

Compares the string with another fixed_string.

Template parameters
N2 The size of the other fixed_string.
Parameters
rhs in The other fixed_string to compare with.
Returns Negative value if less, zero if equal, positive value if greater.

template <std::size_t N>
const_reverse_iterator rll::fixed_string::crbegin() const constexpr noexcept

Retrieves the constant reverse begin iterator of the fixed_string.

Returns A constant reverse iterator to the beginning of the reversed fixed_string.

Returns a constant reverse iterator pointing to the last character of the fixed_string. If the fixed_string is empty, the returned iterator will be equal to crend().

template <std::size_t N>
const_reverse_iterator rll::fixed_string::crend() const constexpr noexcept

Retrieves the constant reverse end iterator of the fixed_string.

Returns A constant reverse iterator to the end of the reversed fixed_string.

Returns a reverse iterator pointing to the position preceding the first character of the fixed_string when reversed. This iterator acts as a placeholder and should not be dereferenced.

template <std::size_t N>
const_pointer rll::fixed_string::data() const constexpr noexcept

Provides a pointer to the underlying data.

Returns Pointer to the underlying data storage.

Returns a pointer to the underlying array serving as the string's storage. The range [data(), data() + size()) is valid even if the string is empty, but the data is not dereferenceable in that case.

template <std::size_t N>
bool rll::fixed_string::empty() const constexpr noexcept

Checks if the fixed_string is empty.

Returns true if the fixed_string is empty, false otherwise.

Evaluates whether the fixed_string contains no characters.

template <std::size_t N>
const_iterator rll::fixed_string::end() const constexpr noexcept

Retrieves the end iterator of the fixed_string.

Returns A constant iterator to the element following the last character.

Returns an iterator pointing to the past-the-end character of the fixed_string. This iterator acts as a placeholder and should not be dereferenced.

template <std::size_t N>
const_reference rll::fixed_string::front() const constexpr noexcept

Accesses the first element.

Returns Reference to the first element.

Provides a reference to the first element in the string. Undefined behavior occurs if this function is called on an empty string.

template <std::size_t N>
std::size_t rll::fixed_string::hash() const constexpr noexcept

Calculates the hash of the string.

Returns The hash value of the string.

Computes a hash value for the string using a FNV-1a hash function.

template <std::size_t N>
const_reference rll::fixed_string::operator[](std::size_t const n) const constexpr noexcept

Accesses the character at the specified location with bounds checking.

Parameters
in The position of the character to return.
Returns A reference to the character at the specified location.
Exceptions
std::out_of_range When going beyond the bounds of the character array.

Returns a reference to the character at the specified location n. If n is out of bounds, an exception of type std::out_of_range will be thrown.

template <std::size_t N>
const_reverse_iterator rll::fixed_string::rbegin() const constexpr noexcept

Retrieves the reverse begin iterator of the fixed_string.

Returns A constant reverse iterator to the beginning of the reversed fixed_string.

Returns a reverse iterator pointing to the last character of the fixed_string. If the fixed_string is empty, the returned iterator will be equal to rend().

template <std::size_t N>
const_reverse_iterator rll::fixed_string::rend() const constexpr noexcept

Retrieves the reverse end iterator of the fixed_string.

Returns A constant reverse iterator to the end of the reversed fixed_string.

Returns a reverse iterator pointing to the position preceding the first character of the fixed_string. This iterator acts as a placeholder and should not be dereferenced.

template <std::size_t N>
size_t rll::fixed_string::size() const constexpr noexcept

Retrieves the size of the fixed_string.

Returns The number of characters in the fixed_string.

Returns the number of characters currently stored in the fixed_string.

template <std::size_t N>
void rll::fixed_string::swap(fixed_string& other) constexpr noexcept

Swaps the contents with another fixed_string.

Parameters
other in/out The other fixed_string to swap with.

template <std::size_t N>
template <typename T, std::size_t N>
fixed_string<N - 1> make_fixed_string(T const(&data)[N]) constexpr noexcept(…)

Creates a fixed-length string from a character array.

Template parameters
T The character type of the input array.
N The size of the character array plus one for the null terminator.
Parameters
data in The character array to initialize the fixed_string with.
Returns A fixed_string object of size N-1.

Constructs a fixed_string object from a character array, deducing the size automatically.

template <std::size_t N>
template <typename T, std::size_t N>
fixed_string<N - 1> make_fixed_string(T const(&data)[N], bool& code) constexpr noexcept

Creates a fixed-length string from a character array.

Template parameters
T The character type of the input array.
N The size of the character array plus one for the null terminator.
Parameters
data in The character array to initialize the fixed_string with.
code out A reference to an error_code object that will be set if an error occurs during parsing.
Returns A fixed_string object of size N-1.

Constructs a fixed_string object from a character array, deducing the size automatically.

template <std::size_t N>
template <std::size_t N1, std::size_t N2>
bool operator!=(fixed_string<N1> const& lhs, fixed_string<N2> const& rhs) constexpr noexcept

Compares the contents of two fixed strings for inequality.

Template parameters
N1 The maximum number of characters of lhs.
N2 The maximum number of characters of rhs.
Parameters
lhs in The fixed string whose contents to compare.
rhs in The fixed string whose contents to compare.
Returns true if the contents of the strings are not equal, false otherwise.

Checks if the contents of lhs and rhs are not equal, meaning they do not have the same number of elements or there is at least one position at which the elements in lhs and rhs differ.

template <std::size_t N>
template <size_t N1, size_t N2>
bool operator<(fixed_string<N1> const& lhs, fixed_string<N2> const& rhs) constexpr noexcept

Compares the contents of two fixed strings lexicographically.

Template parameters
N1 The maximum number of characters of lhs.
N2 The maximum number of characters of rhs.
Parameters
lhs in The fixed string whose contents to compare.
rhs in The fixed string whose contents to compare.
Returns true if the contents of lhs are lexicographically less than the contents of rhs, false otherwise.

Checks if the contents of lhs are lexicographically less than the contents of rhs.

template <std::size_t N>
template <size_t N1, size_t N2>
bool operator<=(fixed_string<N1> const& lhs, fixed_string<N2> const& rhs) constexpr noexcept

Compares the contents of two fixed strings for less than or equal relation.

Template parameters
N1 The maximum number of characters of lhs.
N2 The maximum number of characters of rhs.
Parameters
lhs in The fixed string whose contents to compare.
rhs in The fixed string whose contents to compare.
Returns true if lhs is lexicographically less than or equal to rhs, false otherwise.

Determines if the contents of lhs are lexicographically less than or equal to the contents of rhs.

template <std::size_t N>
template <std::size_t N1, std::size_t N2>
bool operator==(fixed_string<N1> const& lhs, fixed_string<N2> const& rhs) constexpr noexcept

Compares the contents of two fixed strings for equality.

Template parameters
N1 The maximum number of characters of lhs.
N2 The maximum number of characters of rhs.
Parameters
lhs in The fixed string whose contents to compare.
rhs in The fixed string whose contents to compare.
Returns true if the contents of the strings are equal, false otherwise.

Checks if the contents of lhs and rhs are equal, meaning they have the same number of elements and each element in lhs compares equal with the element in rhs at the same position.

template <std::size_t N>
template <size_t N1, size_t N2>
bool operator>(fixed_string<N1> const& lhs, fixed_string<N2> const& rhs) constexpr noexcept

Compares the contents of two fixed strings for greater than relation.

Template parameters
N1 The maximum number of characters of lhs.
N2 The maximum number of characters of rhs.
Parameters
lhs in The fixed string whose contents to compare.
rhs in The fixed string whose contents to compare.
Returns true if lhs is lexicographically greater than rhs, false otherwise.

Determines if the contents of lhs are lexicographically greater than the contents of rhs.

template <std::size_t N>
template <size_t N1, size_t N2>
bool operator>=(fixed_string<N1> const& lhs, fixed_string<N2> const& rhs) constexpr noexcept

Compares the contents of two fixed strings for greater than or equal relation.

Template parameters
N1 The maximum number of characters of lhs.
N2 The maximum number of characters of rhs.
Parameters
lhs in The fixed string whose contents to compare.
rhs in The fixed string whose contents to compare.
Returns true if lhs is lexicographically greater than or equal to rhs, false otherwise.

Determines if the contents of lhs are lexicographically greater than or equal to the contents of rhs.