I recently learned how to use the vecor library in C++. I don't understant what is the vector default constructor or when should I use it.
If for example I have a struct and want to create a vector of n structs. Is the following code valid:
struct item
{
string id;
string name;
};
vector <item> vitem;
vitem.push_back(item());
Does this vector have one element? or no elements at all?
std::cout << vitem.size() << std::endlholds the answer to your question.