return res;
}
+/**
+ A general set operation that takes a condition and returns if there exists
+ any item for which the boolean guard holds.
+*/
+template <class T>
+inline bool HasItem(set<T> *original, std::function<bool(T)> condition) {
+ ForEach (_M, original) {
+ if (condition(_M))
+ return true;
+ }
+ return false;
+}
+
+
+
/**
A general sublist operation that takes a condition and returns all the item
for which the boolean guard holds in the same order as in the old list.
ms->insert(m);
MakeSet(int, ms, newis, STATE(x));
- cout << "Size=" << Size(newis) << " | val= " << Belong(newis, 2) << endl;
+ //cout << "Size=" << Size(newis) << " | val= " << Belong(newis, 2) << endl;
+ cout << "HasItem=" << HasItem(ms, Guard(STATE(x) == 2)) << endl;
ForEach (i, newis) {
- cout << "elem: " << i << endl;
+ //cout << "elem: " << i << endl;
}