whats wrong with the last line?
no matching function for call to 'std::vector<std::vector<int*>*>::push_back(std::vector<int*>&)'
test2.push_back(test);
1 2 3 4 5 6 7 8 9
int *ptr;
int *ptr2;
*ptr = 1;
*ptr = 2;
std::vector<int*> test;
std::vector<std::vector<int*>*> test2;
test.push_back(ptr);
test.push_back(ptr2);
test2.push_back(test);
I wonder why you have a vector of pointer to vector at all? Is it because you think pointers to vector are more efficient? If so, I doubt that is necessary. Equally unsure as to why you want a vector of pointer to int? This usually not worth it: the pointer is the same size as the int on a 32 bit machine, and twice as big on a 64 bit machine - 64 bit is common these days. In short, don't bother with pointers to built in types, and use references where you can otherwise, unless doing polymorphism.
C++11 has perfect forwarding, copy elision and move semantics, so one can pass things by value more often than before.
Also, there could be alternatives to vector of vector, but maybe the composite design pattern is overkill?
Edit:
I didn't see the last 2 posts, while doing mine :+)
added to it is i should go with std::vector<std::vector<int*>*> test2; or std::vector<std::vector<int*>> test2;?
(assume that int is a noncopyable class)
Use std::vector<std::vector<T>> if T is a movable type.
Otherwise you could use std::vector<std::vector<T*>> .
Another option if the objects are dynamically allocated with new is to use std::vector<std::vector<std::unique_ptr<T>>> so that you don't have to worry about using delete.