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 8a26b6174d - Show all commits

View File

@@ -1219,14 +1219,21 @@ public:
//! \sa removeRow(), PIVector::remove()
inline PIVector2D<T> & removeColumn(size_t col) {
if (col >= cols_ || rows_ == 0) return *this;
PIVector2D<T> result(rows_, cols_ - 1);
for (size_t r = 0; r < rows_; ++r) {
for (size_t c = 0, nc = 0; c < cols_; ++c) {
if (c == col) continue;
result.element(r, nc++) = element(r, c);
T * dst = mat.data(r * (cols_ - 1));
T * src = mat.data(r * cols_);
if (col > 0) {
memmove(dst, src, col * sizeof(T));
dst += col;
src += col;
}
size_t remaining = (cols_ - 1) - col;
if (remaining > 0) {
memmove(dst, src + 1, remaining * sizeof(T));
}
}
swap(result);
cols_--;
mat.resize(rows_ * cols_);
return *this;
}