I am completely aware that set_difference
can subtract two sets and I am aware that operators are syntactic sugars. But, I am wondering why the standard library designers do not provide such a functionality so subtraction becomes such easy?
#include <iostream>
#include <algorithm>
#include <set>
int main ()
{
std::set<int> s1{5,10,15,20,25};
std::set<int> s2{50,40,30,20,10};
for (int x: s1 - s2)
std::cout << ' ' << x;
std::cout << '\n';
return 0;
}
instead of using this complication:
std::set_difference (s1.begin(), s1.end(), s2.begin(), s2.end(), v.begin());
Is there any implementation impediments?