Home | History | Annotate | Download | only in set.union
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <algorithm>
     11 
     12 // template<InputIterator InIter1, InputIterator InIter2, typename OutIter,
     13 //          CopyConstructible Compare>
     14 //   requires OutputIterator<OutIter, InIter1::reference>
     15 //         && OutputIterator<OutIter, InIter2::reference>
     16 //         && Predicate<Compare, InIter1::value_type, InIter2::value_type>
     17 //         && Predicate<Compare, InIter2::value_type, InIter1::value_type>
     18 //   OutIter
     19 //   set_union(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2,
     20 //             OutIter result, Compare comp);
     21 
     22 // UNSUPPORTED: c++98, c++03
     23 
     24 #include <algorithm>
     25 #include <cassert>
     26 #include <iterator>
     27 #include <vector>
     28 
     29 #include "MoveOnly.h"
     30 
     31 
     32 int main()
     33 {
     34     std::vector<MoveOnly> lhs, rhs;
     35     lhs.push_back(MoveOnly(2));
     36     rhs.push_back(MoveOnly(2));
     37 
     38     std::vector<MoveOnly> res;
     39     std::set_union(std::make_move_iterator(lhs.begin()),
     40                    std::make_move_iterator(lhs.end()),
     41                    std::make_move_iterator(rhs.begin()),
     42                    std::make_move_iterator(rhs.end()), std::back_inserter(res));
     43 
     44     assert(res.size() == 1);
     45     assert(res[0].get() == 2);
     46 }
     47