user478571
user478571

Reputation:

vector initialization in constructor

Is it necessary to initialize ;

- vector<string>
- vector<string*>

in constructor ?

Upvotes: 1

Views: 550

Answers (1)

Erik
Erik

Reputation: 91270

No. Default initialization will be fine.

For vector<string *> you will however need a destructor, a copy constructor and an assignment operator in order to properly delete/copy the string * elements in your vector<string *> member variable.

Upvotes: 6

Related Questions