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

@@ -25,6 +25,7 @@
#include "pimathbase.h"
template<uint Cols, uint Rows, typename Type>
class PIMathMatrixT;
@@ -445,6 +446,20 @@ public:
PIVector<Type> toVector() const {return c;}
const _CVector & forEach(std::function<void(const Type &)> f) const {
c.forEach(f);
return *this;
}
_CVector copyForEach(std::function<Type(const Type &)> f) const {
_CVector ret;
ret.c = c.copyForEach(f);
return ret;
}
_CVector & forEachInplace(std::function<Type(const Type &)> f) {
c.forEachInplace(f);
return *this;
}
inline Type * data() {return c.data();}
inline const Type * data() const {return c.data();}