bit::matrix — Size Queries

How many rows, columns, elements, etc., are in the bit-matrix?

1constexpr std::size_t rows()  const;
2constexpr std::size_t cols()  const;
3constexpr std::size_t size()  const;
4constexpr bool        empty() const;
1
Returns the number of rows in the bit-matrix.
2
Returns the number of columns in the bit-matrix.
3
Returns the number of elements in the bit-matrix.
4
Returns true if the bit-matrix has no elements (so size() == 0), returns false otherwise.

Example

#include <bit/bit.h>
int main()
{
    bit::matrix<> m(3, 4);
    std::cout << "m.rows():      " << m.rows()      << '\n';
    std::cout << "m.cols():      " << m.cols()      << '\n';
    std::cout << "m.size():      " << m.size()      << '\n';
    std::cout << "m.empty():     " << (m.empty()  ? "YES" : "NO") << '\n';
}

Output

m.rows():      3
m.cols():      4
m.size():      12
m.empty():     NO

See Also

matrix::count

Back to top