I want initialize a vector of vector of bool inside my costructor.
This is my class:
class MyClass{
public:
MyClass(const OtherClass&g):
g(g), count(g.node_count(), std::vector<bool>(16))){}
private:
const OtherClass&g;
std::vector<std::vector<bool>>count;
};
but when I try to initialize count I obtain this error:
error: no match for call to ‘(std::vector<std::vector<bool> >) (int)’
vector<bool>, it's a hybrid monster. You can usestd::bitset<>instead.const OtherClass&? Trouble incoming with this design. When you give a reference of an object(A) to an other object(B) this object(A) should belong to him(B) so whyconst? (maybe you don't want to modify him, so it's ok)