mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
fix combinator signatures
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
b8ac3e6ce4
commit
5eefa9c34b
3 changed files with 65 additions and 11 deletions
|
@ -306,28 +306,52 @@ public:
|
|||
// prevent abuse:
|
||||
ref_vector & operator=(ref_vector const & other) = delete;
|
||||
|
||||
ref_vector&& filter(std::function<bool(T)>& predicate) {
|
||||
bool containsp(std::function<bool(T)>& predicate) const {
|
||||
for (auto const& t : *this)
|
||||
if (predicate(t))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
ref_vector filter_pure(std::function<bool(T)>& predicate) const {
|
||||
ref_vector result(m());
|
||||
for (auto& t : *this)
|
||||
if (predicate(t)) result.push_back(t);
|
||||
if (predicate(t))
|
||||
result.push_back(t);
|
||||
return result;
|
||||
}
|
||||
|
||||
ref_vector& filter_update(std::function<bool(T)>& predicate) {
|
||||
unsigned j = 0;
|
||||
for (auto& t : *this)
|
||||
if (predicate(t))
|
||||
set(j++, t);
|
||||
shrink(j);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
vector<S>&& map(std::function<S(T)>& f) {
|
||||
vector<S> mapv_pure(std::function<S(T)>& f) const {
|
||||
vector<S> result;
|
||||
for (auto& t : *this)
|
||||
result.push_back(f(t));
|
||||
return result;
|
||||
}
|
||||
|
||||
ref_vector&& map(std::function<T(T)>& f) {
|
||||
ref_vector map_pure(std::function<T(T)>& f) const {
|
||||
ref_vector result(m());
|
||||
for (auto& t : *this)
|
||||
result.push_back(f(t));
|
||||
return result;
|
||||
}
|
||||
|
||||
ref_vector& map_update(std::function<T(T)>& f) {
|
||||
unsigned j = 0;
|
||||
for (auto& t : *this)
|
||||
set(j++, f(t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -231,21 +231,51 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
vector&& filter(std::function<bool(T)>& predicate) {
|
||||
bool containsp(std::function<bool(T)>& predicate) const {
|
||||
for (auto const& t : *this)
|
||||
if (predicate(t))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* retain elements that satisfy predicate. aka 'where'.
|
||||
*/
|
||||
vector filter_pure(std::function<bool(T)>& predicate) const {
|
||||
vector result;
|
||||
for (auto& t : *this)
|
||||
if (predicate(t)) result.push_back(t);
|
||||
if (predicate(t))
|
||||
result.push_back(t);
|
||||
return result;
|
||||
}
|
||||
|
||||
vector& filter_update(std::function<bool(T)>& predicate) {
|
||||
unsigned j = 0;
|
||||
for (auto& t : *this)
|
||||
if (predicate(t))
|
||||
set(j++, t);
|
||||
shrink(j);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* update elements using f, aka 'select'
|
||||
*/
|
||||
template <typename S>
|
||||
vector<S>&& map(std::function<S(T)>& f) {
|
||||
vector<S> map_pure(std::function<S(T)>& f) const {
|
||||
vector<S> result;
|
||||
for (auto& t : *this)
|
||||
result.push_back(f(t));
|
||||
return result;
|
||||
}
|
||||
|
||||
vector& map_update(std::function<T(T)>& f) {
|
||||
unsigned j = 0;
|
||||
for (auto& t : *this)
|
||||
set(j++, f(t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
if (m_data) {
|
||||
if (CallDestructors) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue