what\'s the alternative?
Should I write by myself?
Who told you that? There's is "find" algorithm for vector
in C++. Ironically Coincidentally, it is called std::find
. Or maybe std::binary_search
. Or something else, depending on the properties of the data stored in your vector.
Containers get their own specific versions of generic algorithms (implemented as container methods) only when the effective implementation of the algorithm is somehow tied to the internal details of the container. std::list<>::sort
would be one example.
In all other cases, the algorithms are implemented by standalone functions.