It is generally recommended that you use pointers when you need to, but references or, alternatively, object objects (think about values) when you can.
First you need to know if gVector3 meets the requirements of standard containers, namely if gVector3 can be copied and assigned. This is useful if gVector3 is also constructive by default (see UPDATE Note below). Assuming this is the case, you have two options: store gVector3 objects directly in std::vector
std::vector<gVector3> points; points.push_back(gVector(1, 2, 3));
or manage the creation (as well as destruction) of gVector3 objects manually.
std :: vector points; points.push_back (new gVector3 (1, 2, 3)); // ...
When the points array is no longer needed, remember to talk about all the elements and call the delete operator on it.
Now, it is your choice if you can manipulate gVector3 as objects (you can assume that you consider them to be values ββor objects), because (if you see the condition above) due to the availability of the copy constructor and assignment operator, operations are possible:
gVector3 v1(1, 2, 3); gVector3 v2; v2 = v1;
or you may need or need to allocate gVector3 objects in dynamic storage using the new operator. So, you may need or need to manage the lifetime of these objects yourself.
By the way, you might also be interested in When to use links and when to use pointers?
UPDATE: This is an explanation of the default design note. Thanks to Neil for being incomprehensible. As Neil correctly noted, this is not required by the C ++ standard, however, I pointed to this function because it is important and useful. If type T not constructive by default, which is not required by the C ++ standard, then the user should be aware of potential problems that I am trying to illustrate below:
#include <vector> struct T { int i; T(int i) : i(i) {} }; int main() { // Request vector of 10 elements std::vector<T> v(10); // Compilation error about missing T::T() function/ctor }