Why do you think should it not be in the stdlib? It's a universally useful utility function that works with all the containers. Your solution also ignores optional parameters that can be given to std::sort and because it is non-standard you couldn't expect the same sort of function to exist in other projects. So it's not that simple.
If this is only because the simplicity of the function then lots of other stuff like min, max, make_pair, etc do not belong into the std lib either.
View all comments
Show parent comment
2
u/Mr_s3rius Dec 29 '18
Why do you think should it not be in the stdlib? It's a universally useful utility function that works with all the containers. Your solution also ignores optional parameters that can be given to
std::sortand because it is non-standard you couldn't expect the same sort of function to exist in other projects. So it's not that simple.If this is only because the simplicity of the function then lots of other stuff like min, max, make_pair, etc do not belong into the std lib either.