/
Ikocs
/
cpp-tasks
Обзор
Документация
Войти
/
Ikocs
/
cpp-tasks
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
37_SetDifference/main.cpp
33 строки
625 B
Alexey Elfimov
Add 37_SetDifference
23 сен 2024, 11:54
23 сен 2024, 11:54
2112cf0
Код
Авторство
О чём код?
#include <iostream> template <typename InIter1, typename InIter2, typename OutIter> OutIter SetDifference(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2, OutIter out) { auto it1 = first1; auto it2 = first2; while (it1 != last1) { while (it2 != last2 && *it2 < *it1) { ++it2; } if (it2 == last2 || *it1 < *it2) { *out = *it1; ++out; } else if (it2 != last2) { ++it2; } ++it1; } return out; } int main() { std::cout << "Hello, World!" << std::endl; return 0; }