在STL中关于有序序列有这么四个算法:
set_union(beg, end, beg, end2, dest); //求并集A∪B
set_union(beg, end, beg, end2, dest, comp);
template <class InputIterator1, class InputIterator2, class OutputIterator>
OutputIterator set_union (InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2,
OutputIterator result)
{
while (true)
{
if (first1==last1) return std::copy(first2,last2,result);
if (first2==last2)