GF2::Vector — Descriptive Data
Dump some descriptive data about a bit-vector to a stream.
constexpr void description(std::ostream &s, +
const std::string &head = "", +
const std::string &foot = "\n") const; (1)
constexpr void description(const std::string &head = "", +
const std::string &foot = "\n") const; (2)
| 1 | Prints data to an arbitrary stream. |
| 2 | Prints the same data to std::cout. |
You can send along some arbitrary text that get prepended or appended to the description of the bit-vector. See the example below.
|
These methods are primarily used for debugging purposes. The format of the descriptive data may change from time to time. |
Example
#include <GF2/GF2.h>
int main()
{
auto v25 = GF2::Vector<>::random(32, 0.25); (1)
v25.description("Random fill with p = 0.25");
}
| 1 | Vector of size 32 randomly filled where the probability of getting set elements is just 25%. |
Output
Random fill with p = 0.25:: (1)
Vector: 10000100000000000011110001010000
As Hex String: 1200C3A0
Number of Bits: 32
Number of Set Bits: 8
Bit Capacity: 64
Unused Capacity: 32
Bits per Block: 64
Blocks Used: 1
Blocks Capacity: 1
| 1 | The optional user supplied header line. |