Skip to main content

fixstr::basic_fixed_string::empty

1#
[[nodiscard]] constexpr bool empty() const noexcept;

Checks if the fixed string has no elements, i.e. whether begin() == end().

Parameters#

(none)

Return value#

true if the fixed string is empty, false otherwise

Complexity#

Constant.

Example#

#include <fixed_string.hpp>#include <iostream>
int main(){    fixstr::fixed_string    hello_world = "Hello, world!";    fixstr::fixed_string<0> no_hello_world;
    std::cout << std::boolalpha;    std::cout << "hello_world.empty(): " << hello_world.empty() << '\n';    std::cout << "no_hello_world.empty(): " << no_hello_world.empty() << '\n';}
Output:
hello_world.empty(): falseno_hello_world.empty(): true