lundi 26 décembre 2016

Why does the C++ standard keep such a redundant function?

  1. std::string::find's prototype:

size_type find( CharT ch, size_type pos = 0 ) const;

  1. std::string::find_first_of's prototype:

std::size_type find_first_of( CharT ch, size_type pos = 0 ) const;

Both have the same function. But it's obvious that the latter is redundant.

I think this redundancy will make the user confused, because find_first_of means "find anyone of the given characters", rather than "find the given character".

Why does the C++ standard keep such a redundant function?

Is there any rationale behind?

Aucun commentaire:

Enregistrer un commentaire