Pointer to a vector?

I'm having trouble just trying to figure out how to make a pointer to a vector, and being able to use that pointer to access the vector elements. So far I've tried:

1
2
3
4
	vector<int> *test;
	test = new vector<int>;

	*test.push_back(1); //error: test must have class type 


1
2
	vector<int> *test = new vector<int>(3);
	test[0] = 1; //error: no "=" matches these operands. 


Now, from looking at the debugger, it looks like the vector is being created. I just can't seem to access/manipulate the elements! Can someone point me in the right direction? (pointer puns are too easy)

1
2
3
4
5
//...
(*test).push_back(1);
//...
(*test)[0] = 1;
//... 

Thanks so much! It's always something simple...
you can also call test->push_back(1) ( "arrow" instead of the dot )
Topic archived. No new replies allowed.