I have simple class with width and height member fields which define number of rows and columns in matrix. I have matrix representation (0nly 0 and 1 needed) like bitset<> fields ( I included ) and I want to set size of bitset field in constructor.
Matrix(int w, int h)
{
// fields to have size w*h
}
private:
int width;
int height;
//bitset<unknown at the moment> fields;
Is possible to achieve this ?
std::vector<bool>does exactly what you need, with 1 bit per value.Alternatively you can use
boost::dynamic_bitset(I think it was called).