While looking over some code I found loopy and algorithmically slow implementation of std::set_difference :
for(int i = 0; i < a.size(); i++) { iter = std
This one does it in O(N+M), assuming both arrays are sorted.
auto ib = std::begin(two); auto iter = std::remove_if ( std::begin(one), std::end(one), [&ib](int x) -> bool { while (ib != std::end(two) && *ib < x) ++ib; return (ib != std::end(two) && *ib == x); });