lundi 18 septembre 2017

where the constructors for list and vector are different

I have one question about list initialize a vector and a list, here is the code:

std::list<string> sLst = {"hello", "world"};
std::vector<string> sVec = {"hello", "world"}; 

I understand why the vector case failed, but don't understand why the list case correct.

Aucun commentaire:

Enregistrer un commentaire