Skip to main content

fixstr::basic_fixed_string::max_size

1#
[[nodiscard]] constexpr size_type max_size() const noexcept;

Returns the maximum number of elements the fixed string is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest fixed string.

note

Because each fixstr::basic_fixed_string<TChar, N, TTraits> is a fixed-size container, the value returned by max_size equals N (which is also the value returned by size);

Parameters#

(none)

Return value#

Maximum number of characters.

Complexity#

Constant.

Example#

#include <fixed_string.hpp>#include <iostream>
int main(){    fixstr::fixed_string s = "Hello, world!";    std::cout << "Maximum size of the 'fixed_string' is " << s.max_size() << "\n";}
Output:
Maximum size of the 'fixed_string' is 13