It is unclear how congestion resolution will work in general. What if, say, a container contains predicates?
struct pred { bool operator()(const pred&) const; friend bool operator==(const pred&,const pred&); }; std::vector<pred> v; pred p; std::find(v.begin(), v.end(), p);
This potential ambiguity is eliminated due to the presence of functions with different names, with each name expressing its intent more clearly.
Note that this is a simplification: in std::find there is no requirement that the reference object be of the same type as the value_type container, just that they are comparable for equality. The predicate requirements in std::find_if are also common. Both of these functions are extremely common, which means that ambiguity can occur more easily than in the above example. For example,
struct foo {}; struct pred { bool operator()(const foo&) const; }; bool operator==(const foo&, const pred&); int main() { std::vector<foo> v; pred p; std::find(v.begin(), v.end(), p);
juanchopanza
source share