//Setting up the class of the objects
class Event
{
public:
int EventStartTimeInSeconds;
int EventDurationInSeconds;
string UserId;
};
int MaximumNumberOfEvents;
cin >> MaximumNumberOfEvents; //Actually this is in the "main" part somewhere
void SetUpAllTheObjects ()
{
//function that gets called to "make" all the objects
for (int i = 0; i < MaximumNumberOfEvents; i++)
{
CreateNewObject() //this is the part that I need help with
}
}
That looks just like what I need, thank you very much!
(When I first read "vector", I was still thinking about "euclidean vectors", so that's probably why it didn't make sense at first and I just thought "I don't want to do anything with those things, I want to create objects!" But that link that you posted mad things a lot clearer ...)
Since you want to create a container of objects you might want to look at std::vector's emplace() and emplace_back() member functions. insert() and push_back() create a temporary object before adding it to the std::vector. The other two functions "create in-place, no temporary." That can be a performance boost when dealing with custom objects.
(When I first read "vector", I was still thinking about "euclidean vectors")
Programming language theory draws more from abstract algebra & related fields:
If the domain of a 3D vector of real numbers is R^3 where R means "all the reals", the domain of a std::vector<int> is int^n where int means "all the possible ints" and n is the size of the vector.
This is the rationale for the name "vector". It's not particular to linear algebra.