bit::vector
— Size Queries
How many elements are in the bit-vector?
- 1
- Returns the number of elements in the bit-vector.
- 2
-
Returns
true
if the bit-vector has no elements (sosize() == 0
), returnsfalse
otherwise.
Example
#include <bit/bit.h>
int main()
{
::vector<> v1;
bitauto v2 = bit::vector<>::checker_board(4);
std::cout
<< "vector\t\t" << "size\t" << "empty?\n"
<< v1 << "\t\t" << v1.size() << '\t' << v1.empty() << '\n'
<< v2 << '\t' << v2.size() << '\t' << v2.empty() << '\n';
}
Output
vector size empty?
[] 0 1
[0 1 0 1] 4 0