Use std::set_union instead of nasty custom code.