vector<item>* Items = new vector<item>();
> where I am placing the vector on the heap instead of the stack
> vector<item>* Items = new vector<item>();
¿why are you doing that?
> When I do this I get a conversion error
The vector holds items, not pointers. When you dereference the iterator, you've got an item.
> However the IDE shows that my pointer can see the member object that the iterator is pointed to.
No, your IDE sees that you are trying to dereference a pointer, it does not known if it points to a proper location.
|2) because this may be useful if I want to encapsulate a large number of objects that I don't want disappearing when that function goes out of scope.|
You're circumventing the whole point of a scope, not to mention that your goal leads to poor program design.
|Does the vector own it? If so, then|
auto_ptr!). Although it is true that common use case for vectors is vectors of objects themselves, not pointers to them, when runtime polymorphism is required, a vector holding (and owning) pointers to bases may be necessary.
vector<item>* Items = new vector<item>();, which has no reasonable justification at all.