Array::Empty
Testes se sem elementos estão presentes.
bool empty() const;
Comentários
A função de membro retorna true somente se N == 0.
Exemplo
// std_tr1__array__array_empty.cpp
// compile with: /EHsc
#include <array>
#include <iostream>
typedef std::tr1::array<int, 4> Myarray;
int main()
{
Myarray c0 = {0, 1, 2, 3};
// display contents " 0 1 2 3"
for (Myarray::const_iterator it = c0.begin();
it != c0.end(); ++it)
std::cout << " " << *it;
std::cout << std::endl;
// display whether c0 is empty " false"
std::cout << std::boolalpha << " " << c0.empty();
std::cout << std::endl;
std::tr1::array<int, 0> c1;
// display whether c1 is empty " true"
std::cout << std::boolalpha << " " << c1.empty();
std::cout << std::endl;
return (0);
}
0 1 2 3 false true
Requisitos
Cabeçalho:<array>
Namespace: std::tr1