I think one of the reasons is the lack of returning std::contains a bool because it is too easy for novice programmers to fall into the trap
if (std::contains(my_container, some_element)) { auto it = std::find(begin(my_container), end(my_container), some_element); // process *it }
and now you do the required work twice.
Just idiomatic to write
auto it = std::find(begin(my_container), end(my_container), some_element); if (it != end(my_container)) { // process *it }
If you insist on using the contains function, you can strive for the best of both worlds by returning std::pair<bool, iterator> or std::optional<iterator> (included in the basic technical specification of the library or already present in Boost), which You can request the following:
if (opt = std::contains(my_container, some_element)) {
source share