#include <bn_string.h>
template<int MaxSize>
bn::string class

std::string like container with a fixed size buffer.

Template parameters
MaxSize Maximum number of characters that can be stored.

It doesn't throw exceptions. Instead, asserts are used to ensure valid usage.

Base classes

class istring
Base class of bn::string.

Constructors, destructors, conversion operators

string() constexpr
Default constructor.
string(const string& other) constexpr
Copy constructor.
string(const istring_base& other) constexpr
Copy constructor.
string(const string_view& view) constexpr
Copy constructor.
string(const_pointer char_array_ptr) constexpr
Copy constructor.
string(const_pointer char_array_ptr, size_type char_array_size) constexpr
Copy constructor.
string(size_type count, value_type value) constexpr
Constructs a string with count copies of character value.
string(const_iterator first, const_iterator last) constexpr
Constructs a string with the characters in the range [first, last).

Public functions

auto operator=(const string& other) -> string& constexpr
Copy assignment operator.
auto operator=(const istring_base& other) -> string& constexpr
Copy assignment operator.
auto operator=(const string_view& view) -> string& constexpr
Copy assignment operator.
auto operator=(const_pointer char_array_ptr) -> string& constexpr
Copy assignment operator.

Friends

auto operator+(const string& a, const istring_base& b) -> string constexpr
Concatenates a string and a istring_base.
auto operator+(const string& a, value_type b) -> string constexpr
Concatenates a string and a character.
auto operator+(const string& a, const string_view& b) -> string constexpr
Concatenates two strings.
auto operator+(const string& a, const_pointer b) -> string constexpr
Concatenates two strings.

Function documentation

template<int MaxSize>
bn::string<MaxSize>::string(const string& other) constexpr

Copy constructor.

Parameters
other string to copy.

template<int MaxSize>
bn::string<MaxSize>::string(const istring_base& other) constexpr

Copy constructor.

Parameters
other istring_base to copy.

template<int MaxSize>
bn::string<MaxSize>::string(const string_view& view) constexpr

Copy constructor.

Parameters
view string_view to copy.

template<int MaxSize>
bn::string<MaxSize>::string(const_pointer char_array_ptr) constexpr

Copy constructor.

Parameters
char_array_ptr Pointer to null-terminated characters array.

template<int MaxSize>
bn::string<MaxSize>::string(const_pointer char_array_ptr, size_type char_array_size) constexpr

Copy constructor.

Parameters
char_array_ptr Pointer to characters array.
char_array_size Characters count of the characters array.

template<int MaxSize>
bn::string<MaxSize>::string(size_type count, value_type value) constexpr

Constructs a string with count copies of character value.

Parameters
count Number of characters to assign.
value Character to assign.

template<int MaxSize>
bn::string<MaxSize>::string(const_iterator first, const_iterator last) constexpr

Constructs a string with the characters in the range [first, last).

Parameters
first First element of the range.
last Last element of the range.

template<int MaxSize>
string& bn::string<MaxSize>::operator=(const string& other) constexpr

Copy assignment operator.

Parameters
other string to copy.
Returns Reference to this.

template<int MaxSize>
string& bn::string<MaxSize>::operator=(const istring_base& other) constexpr

Copy assignment operator.

Parameters
other istring_base to copy.
Returns Reference to this.

template<int MaxSize>
string& bn::string<MaxSize>::operator=(const string_view& view) constexpr

Copy assignment operator.

Parameters
view string_view to copy.
Returns Reference to this.

template<int MaxSize>
string& bn::string<MaxSize>::operator=(const_pointer char_array_ptr) constexpr

Copy assignment operator.

Parameters
char_array_ptr Pointer to null-terminated characters array.
Returns Reference to this.

template<int MaxSize>
string operator+(const string& a, const istring_base& b) constexpr

Concatenates a string and a istring_base.

Parameters
a First string to concatenate.
b Second istring_base to concatenate.
Returns string containing characters from a followed by the characters from b.

template<int MaxSize>
string operator+(const string& a, value_type b) constexpr

Concatenates a string and a character.

Parameters
a First string to concatenate.
b Second character to concatenate.
Returns string containing characters from a followed by b.

template<int MaxSize>
string operator+(const string& a, const string_view& b) constexpr

Concatenates two strings.

Parameters
a First string to concatenate.
b Second string_view to concatenate.
Returns string containing characters from a followed by the characters from b.

template<int MaxSize>
string operator+(const string& a, const_pointer b) constexpr

Concatenates two strings.

Parameters
a First string to concatenate.
b Second pointer to null-terminated characters array to concatenate.
Returns string containing characters from a followed by the characters from b.