PIVector2D - add funcs, optimize, tests, fixes, doxygen #194

Merged
andrey merged 29 commits from vibecoding_pivector2d into master 2026-02-27 23:58:45 +03:00
Showing only changes of commit 39c1be6bc0 - Show all commits

View File

@@ -1668,16 +1668,12 @@ public:
return result; return result;
} }
//! \~english Returns a new 2D array (as a single row) containing only the elements that pass the test. //! \~english Returns a new plain array containing only the elements that pass the test.
//! \~russian Возвращает новый двумерный массив (в виде одной строки), содержащий только элементы, прошедшие проверку. //! \~russian Возвращает новый одноменый массив, содержащий только элементы, прошедшие проверку.
//! \param test Predicate taking a const T&. //! \param test Predicate taking a const T&.
//! \return A 1xN 2D array with the filtered elements (or empty). //! \return PIVector<T> with the filtered elements (or empty).
//! \sa PIVector::filter() //! \sa PIVector::filter()
inline PIVector2D<T> filterElements(std::function<bool(const T &)> test) const { inline PIVector<T> filterElements(std::function<bool(const T &)> test) const { return mat.filter(test); }
PIVector<T> filtered = mat.filter(test);
if (filtered.isEmpty()) return PIVector2D<T>();
return PIVector2D<T>(1, filtered.size(), filtered);
}
protected: protected:
size_t rows_, cols_; size_t rows_, cols_;