Namespaces
Variants
Views
Actions

std::{{{1}}}::empty

From cppreference.com
Revision as of 17:11, 23 December 2023 by Space Mission (Talk | contribs)

bool empty() const noexcept;
(since {std})
(until C++20)
[[nodiscard]] bool empty() const noexcept;
(since C++20)

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

Contents

Parameters

(none)

Return value

true if the container is empty, false otherwise.

Complexity

Constant.

Example

See also

returns the number of elements
(public member function of std::{{{1}}}) [edit]
(C++17)
checks whether the container is empty
(function template) [edit]