Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1.  
  2. template <typename It1, typename It2, typename Out>
  3. Out mystd::set_difference(It1 first1, It1 last1,
  4.                           It2 first2, It2 last2, Out out) {
  5.     while (first1 != last1) {
  6.         if (first2 == last2) {
  7.             return std::copy(first1, last1, out);
  8.         }
  9.         if (*first1 < *first2) {
  10.             *out++ = *first1++;
  11.         } else {
  12.             if (*first2 >= *first1) {
  13.                 ++first1;
  14.             }
  15.             ++first2;
  16.         }
  17.     }
  18.     return out;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement