vector and maitrix foreach

This commit is contained in:
2021-07-01 14:00:04 +03:00
parent f44bd5ef34
commit 040eb3b279
2 changed files with 29 additions and 0 deletions

View File

@@ -274,6 +274,20 @@ public:
mat.clear();
}
const PIVector2D<T> & forEach(std::function<void(const T &)> f) const {
mat.forEach(f);
return *this;
}
PIVector2D<T> copyForEach(std::function<T(const T &)> f) const {
PIVector2D<T> ret(*this);
ret.mat = mat.copyForEach(f);
return ret;
}
PIVector2D<T> & forEachInplace(std::function<T(const T &)> f) {
mat.forEachInplace(f);
return *this;
}
protected:
size_t rows_, cols_;
PIVector<T> mat;