Namespaces
Variants
Views
Actions

Difference between revisions of "Template:cpp/container/empty"

From cppreference.com
m (Update links.)
(don't use ddcl)
Line 1: Line 1:
 
{{cpp/container/{{{1|}}}/title | empty}}
 
{{cpp/container/{{{1|}}}/title | empty}}
 
{{cpp/container/{{{1|}}}/navbar}}
 
{{cpp/container/{{{1|}}}/navbar}}
{{ddcl | notes={{cpp/container/mark since c++11 | {{{1|}}} }} |
+
{{dcl begin}}
 +
{{dcl | since={{cpp/std|{{{1|}}}}} |
 
{{#ifeq:{{{1|}}}|array|constexpr bool empty() const;|bool empty() const;}}
 
{{#ifeq:{{{1|}}}|array|constexpr bool empty() const;|bool empty() const;}}
 
}}
 
}}
 +
{{dcl end}}
 +
 
Checks if the container has no elements, i.e. whether {{c|begin() {{==}} end()}}.
 
Checks if the container has no elements, i.e. whether {{c|begin() {{==}} end()}}.
  

Revision as of 04:00, 25 June 2013

bool empty() const;
(since {std})

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

Exceptions

noexcept specification:  
noexcept
  

Complexity

Constant

Example

See also

returns the number of elements
(public member function of std::{{{1}}}) [edit]