GF2::Matrix — Clear out a Bit-Matrix
Removes all elements from a bit-matrix.
constexpr Matrix &clear();
The bit-matrix’s rows(), cols(), and size() all become 0, but the capacity is not changed.
Method returns a reference to *this so it can be chained with other calls.
Example
#include <GF2/GF2.h>
int main()
{
auto m = GF2::Matrix<>::random(8ul, 16ul);
std::cout << "Pre-clear:\n" << m << '\n';
std::cout << "Post-clear:\n" << m.clear() << '\n';
std::cout << "m.rows(): " << m.rows() << '\n';
std::cout << "m.cols(): " << m.cols() << '\n';
std::cout << "m.size(): " << m.size() << '\n';
}
Output
Pre-clear:
0001000100010100
0010100101010101
1011010100101111
1001001011111101
0100001110011001
1010011111111001
1111011111001001
1101101000110011
Post-clear:
m.rows(): 0
m.cols(): 0
m.size(): 0