R
Ruby Stevenson
All -
I have a newbie question. Let me try to use an example to illustrate:
I have some Event class defined, and I could save a collection of
event objects in two ways:
method 1:
vector<Event*> event_vec;
....
Event * event = new Event();
event_vec.push_back(event);
method 2:
vector<Event> event_vec;
....
Event event;
event_vec.push_back(event)
So one is store a pointer to event; the other store a copy of the
event in a container.
what are the implications between the two choices? when would be the
proper use of one instead of the other?
Thanks
Ruby
I have a newbie question. Let me try to use an example to illustrate:
I have some Event class defined, and I could save a collection of
event objects in two ways:
method 1:
vector<Event*> event_vec;
....
Event * event = new Event();
event_vec.push_back(event);
method 2:
vector<Event> event_vec;
....
Event event;
event_vec.push_back(event)
So one is store a pointer to event; the other store a copy of the
event in a container.
what are the implications between the two choices? when would be the
proper use of one instead of the other?
Thanks
Ruby