20 #ifndef LIMI_INTERNAL_HELPERS_H
21 #define LIMI_INTERNAL_HELPERS_H
23 #include <unordered_set>
27 #include "../generics.h"
31 template <
class Key,
class Hash = std::hash<Key>,
class Pred = std::equal_to<Key>>
32 void print_set(
const std::unordered_set<Key, Hash, Pred>& set1, std::ostream& out,
const printer_base<Key>& printerK = printer<Key>()) {
34 for (
auto it = set1.begin(); it!=set1.end();) {
47 void print_vector(
const std::vector<Key>& vector1, std::ostream& out,
const printer_base<Key>& printerK = printer<Key>()) {
49 for (
auto it = vector1.begin(); it!=vector1.end();) {
52 if (it!=vector1.end()) {
62 void print_list(
const std::list<Key>& vector1, std::ostream& out,
const printer_base<Key>& printerK = printer<Key>()) {
64 for (
auto it = vector1.begin(); it!=vector1.end();) {
67 if (it!=vector1.end()) {
76 template <
class Items>
77 void print_array(
const Items* items,
unsigned length, std::ostream& out,
const printer_base<Items>& printerK = printer<Items>()) {
79 for (
unsigned i = 0; i<length; i++) {
80 printerK(items[i], out);
88 template <
class Keys,
class Hash,
class Pred,
class Alloc>
89 void set_remove(std::unordered_set<Keys,Hash,Pred,Alloc>& set1,
const std::unordered_set<Keys,Hash,Pred,Alloc>& set2) {
90 for (
const auto& item : set2) {
91 auto it = set1.find(item);
97 template <
class Keys,
class Hash,
class Pred,
class Alloc>
98 void set_intersect(std::unordered_set<Keys,Hash,Pred,Alloc>& set1,
const std::unordered_set<Keys,Hash,Pred,Alloc>& set2) {
99 for (
auto it = set1.begin(); it!=set1.end(); ) {
100 if (set2.find(*it)==set2.end())
107 template <
class Keys,
class Hash,
class Pred,
class Alloc>
108 bool set_intersection_empty(
const std::unordered_set<Keys,Hash,Pred,Alloc>& set1,
const std::unordered_set<Keys,Hash,Pred,Alloc>& set2) {
109 for (
const auto& item : set1) {
110 if (set2.find(item)!=set2.end())
116 template <
class Keys,
class Hash,
class Pred,
class Alloc>
117 void set_union(std::unordered_set<Keys,Hash,Pred,Alloc>& set1,
const std::unordered_set<Keys,Hash,Pred,Alloc>& set2) {
118 for (
const auto& item : set2) {
125 #endif // LIMI_INTERNAL_HELPERS_H
The main namespace of the library.
Definition: antichain_algo.h:40