add PIVector2D Index

This commit is contained in:
2026-02-27 00:34:56 +03:00
parent b01aecc2fe
commit 56ff28c793
2 changed files with 85 additions and 4 deletions

View File

@@ -517,8 +517,8 @@ public:
//! \~english Accesses the element at the given column index within the row.
//! \~russian Доступ к элементу по заданному индексу столбца в строке.
//! \details
//! \~english No bounds checking is performed in release builds; use with caution.
//! \~russian В релизной сборке проверка границ не выполняется; используйте с осторожностью.
//! \~english No bounds checking is performed; use with caution.
//! \~russian Проверка границ не выполняется; используйте с осторожностью.
//! \sa PIVector::operator[]
inline T & operator[](size_t index) { return (*p_)[this->st_ + index]; }
@@ -669,10 +669,33 @@ public:
//! \~russian Возвращает константную ссылку на элемент по заданной строке и столбцу.
inline const T & element(size_t row, size_t col) const { return mat[row * cols_ + col]; }
//! \~english Returns a const reference to the element at the given row and column (bounds-checked only in debug).
//! \~russian Возвращает константную ссылку на элемент по заданной строке и столбцу (проверка границ только в отладочном режиме).
//! \~english Returns a const reference to the element at the given row and column
//! \~russian Возвращает константную ссылку на элемент по заданной строке и столбцу
//! \details
//! \~english No bounds checking is performed.
//! \~russian Проверка границ не выполняется.
inline const T & at(size_t row, size_t col) const { return mat[row * cols_ + col]; }
//! \~english Returns a reference to the element at the given Index.
//! \~russian Возвращает ссылку на элемент по заданному Index.
inline T & operator[](const Index & idx) { return element(idx.row, idx.col); }
//! \~english Returns a const reference to the element at the given Index.
//! \~russian Возвращает константную ссылку на элемент по заданному Index.
inline const T & operator[](const Index & idx) const { return element(idx.row, idx.col); }
//! \~english Returns a reference to the element at the given Index.
//! \~russian Возвращает ссылку на элемент по заданному Index.
inline T & element(const Index & idx) { return element(idx.row, idx.col); }
//! \~english Returns a const reference to the element at the given Index.
//! \~russian Возвращает константную ссылку на элемент по заданному Index.
inline const T & element(const Index & idx) const { return element(idx.row, idx.col); }
//! \~english Returns a const reference to the element at the given Index (bounds-checked only in debug).
//! \~russian Возвращает константную ссылку на элемент по заданному Index (проверка границ только в отладочном режиме).
inline const T & at(const Index & idx) const { return at(idx.row, idx.col); }
//! \~english Returns a proxy object for the row at the given index for modification.
//! \~russian Возвращает прокси-объект для строки по заданному индексу для модификации.
//! \sa row(), Col