bn::istring_base class

Base class of bn::istring.

It avoids circular references when including bn::istring header.

Derived classes

class istring
Base class of bn::string.

Public types

using value_type = char
Value type alias.
using size_type = int
Size type alias.
using difference_type = int
Difference type alias.
using reference = char&
Reference alias.
using const_reference = const char&
Const reference alias.
using pointer = char*
Pointer alias.
using const_pointer = const char*
Const pointer alias.
using iterator = char*
Iterator alias.
using const_iterator = const char*
Const iterator alias.

Constructors, destructors, conversion operators

template<int MaxSize>
istring_base(char(&char_array_ref)[MaxSize]) constexpr
Constructor.

Public functions

auto size() const -> size_type constexpr
Returns the number of characters in the istring_base.
auto length() const -> size_type constexpr
Returns the number of characters in the istring_base.
auto max_size() const -> size_type constexpr
Returns the maximum possible number of characters in the istring_base.
auto available() const -> size_type constexpr
Returns the remaining characters capacity.
auto empty() const -> bool constexpr
Indicates if it doesn't contain any character.
auto full() const -> bool constexpr
Indicates if it can't contain any more characters.
auto data() const -> const_pointer constexpr
Returns a const pointer to the beginning of the characters data.
auto data() -> pointer constexpr
Returns a const pointer to the beginning of the characters data.
auto c_str() const -> const_pointer constexpr
Returns a const pointer to the beginning of the characters data (it is null-terminated).
auto begin() const -> const_iterator constexpr
Returns a const iterator to the beginning of the characters data.
auto begin() -> iterator constexpr
Returns an iterator to the beginning of the characters data.
auto end() -> iterator constexpr
Returns a const iterator to the end of the characters data.
auto end() const -> const_iterator constexpr
Returns an iterator to the end of the characters data.
auto cbegin() const -> const_iterator constexpr
Returns a const iterator to the beginning of the characters data.
auto cend() const -> const_iterator constexpr
Returns a const iterator to the end of the characters data.
void clear() constexpr
Removes all characters.

Friends

auto operator==(const istring_base& a, const istring_base& b) -> bool constexpr
Equal operator.
auto operator!=(const istring_base& a, const istring_base& b) -> bool constexpr
Not equal operator.
auto operator<(const istring_base& a, const istring_base& b) -> bool constexpr
Less than operator.
auto operator>(const istring_base& a, const istring_base& b) -> bool constexpr
Greater than operator.
auto operator<=(const istring_base& a, const istring_base& b) -> bool constexpr
Less than or equal operator.
auto operator>=(const istring_base& a, const istring_base& b) -> bool constexpr
Greater than or equal operator.

Function documentation

template<int MaxSize>
bn::istring_base::istring_base(char(&char_array_ref)[MaxSize]) constexpr

Constructor.

Parameters
char_array_ref Non empty const characters array.

The characters are not copied but referenced, so they should outlive the istring_base to avoid dangling references.

bool operator==(const istring_base& a, const istring_base& b) constexpr

Equal operator.

Parameters
a First istring_base to compare.
b Second istring_base to compare.
Returns true if the first istring_base is equal to the second one, otherwise false.

bool operator!=(const istring_base& a, const istring_base& b) constexpr

Not equal operator.

Parameters
a First istring_base to compare.
b Second istring_base to compare.
Returns true if the first istring_base is not equal to the second one, otherwise false.

bool operator<(const istring_base& a, const istring_base& b) constexpr

Less than operator.

Parameters
a First istring_base to compare.
b Second istring_base to compare.
Returns true if the first istring_base is lexicographically less than the second one, otherwise false.

bool operator>(const istring_base& a, const istring_base& b) constexpr

Greater than operator.

Parameters
a First istring_base to compare.
b Second istring_base to compare.
Returns true if the first istring_base is lexicographically greater than the second one, otherwise false.

bool operator<=(const istring_base& a, const istring_base& b) constexpr

Less than or equal operator.

Parameters
a First istring_base to compare.
b Second istring_base to compare.
Returns true if the first istring_base is lexicographically less than or equal to the second one, otherwise false.

bool operator>=(const istring_base& a, const istring_base& b) constexpr

Greater than or equal operator.

Parameters
a First istring_base to compare.
b Second istring_base to compare.
Returns true if the first istring_base is lexicographically greater than or equal to the second one, otherwise false.