How do I create and access a vector of pointers to vectors. What I mean by this is:
std::vector<size_t>, vec1, vec2, vec3;
int main() {
std::vector<std::vector<size_t>*> vecP {
&vec1,
&vec2,
&vec3
};
}
initializing vecP like this seems to work, or at least in Visual Studio, it doesn't give any red underlines indicating a syntax error. However if I try to access it like this:
//continuing int main()
vecP[1].resize(6);
//or
vecP[1][3] = 7;
it doesn't work.
Something about expression must have class type, if I replace the vecP's in the above block with vecP it will say no operator "" matches these operands.
I'm pretty new to the idea of pointers in c++ and I'm sure the solution is simple, but regardless all help is appreciated.