mardi 30 juin 2020

Why in C++11 we move from one function in vector::resize to 2 version?

I'm asking this because im developing a class library. (As i can see in cplusplus.com) in C++98 we had only one version from the resize funcion:

void resize (size_type n, value_type val = value_type());

this way the function works if you want to specify the second argument or not. But in C++11 they change it to 2 different version:

void resize (size_type n);
void resize (size_type n, const value_type& val);

Is any special reason for this?

Aucun commentaire:

Enregistrer un commentaire