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 97691e888c - Show all commits

View File

@@ -1321,14 +1321,16 @@ public:
//! piCout << v; // {1, 3, 7, 5} //! piCout << v; // {1, 3, 7, 5}
//! \endcode //! \endcode
//! \~\sa \a append(), \a prepend(), \a remove() //! \~\sa \a append(), \a prepend(), \a remove()
inline PIVector<T> & insert(size_t index, const T & e = T()) { inline PIVector<T> & insert(size_t index, const T & e = T(), size_t count = 1) {
alloc(piv_size + 1); alloc(piv_size + count);
if (index < piv_size - 1) { if (index < piv_size - count) {
const size_t os = piv_size - index - 1; const size_t os = piv_size - index - count;
memmove(reinterpret_cast<void *>(piv_data + index + 1), reinterpret_cast<const void *>(piv_data + index), os * sizeof(T)); memmove(reinterpret_cast<void *>(piv_data + index + count), reinterpret_cast<const void *>(piv_data + index), os * sizeof(T));
}
PIINTROSPECTION_CONTAINER_USED(T, count)
for (size_t i = 0; i < count; ++i) {
elementNew(piv_data + index + i, e);
} }
PIINTROSPECTION_CONTAINER_USED(T, 1)
elementNew(piv_data + index, e);
return *this; return *this;
} }