summaryrefslogtreecommitdiff
path: root/include/libHX/intdiff.hpp
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2022-10-24 21:04:00 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2022-10-24 21:04:00 +0200
commit3422d8db505630a70bc89a4eee7db927b8e5ec2f (patch)
treef0c6e1ba7db9991f2bd38c9169f9921bfe5e61d8 /include/libHX/intdiff.hpp
parentdf5167db909a88fb8e16dd20b37442495a6ac059 (diff)
parentaab49e5a013c53ae812a143fe41add74e0677a61 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'include/libHX/intdiff.hpp')
-rw-r--r--include/libHX/intdiff.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/libHX/intdiff.hpp b/include/libHX/intdiff.hpp
new file mode 100644
index 0000000..17300a1
--- /dev/null
+++ b/include/libHX/intdiff.hpp
@@ -0,0 +1,24 @@
+#ifndef LIBHX_INTDIFF_HPP
+#define LIBHX_INTDIFF_HPP 1
+#include <algorithm>
+namespace HX {
+template<typename AIter, typename BIter, typename XIter,
+ typename YIter, typename ZIter>
+void set_intersect_diff(AIter a_first, AIter a_last, BIter b_first,
+ BIter b_last, XIter xptr, YIter yptr, ZIter zptr)
+{
+ while ((a_first != a_last) && (b_first != b_last)) {
+ if (*a_first < *b_first)
+ *xptr++ = *a_first++;
+ else if (*b_first < *a_first)
+ *yptr++ = *b_first++;
+ else {
+ *zptr++ = *a_first++;
+ ++b_first;
+ }
+ }
+ std::copy(a_first, a_last, xptr);
+ std::copy(b_first, b_last, yptr);
+}
+}
+#endif