готово
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
#ifndef PIVECTOR2D_H
|
||||
#define PIVECTOR2D_H
|
||||
|
||||
#include "pipair.h"
|
||||
#include "pivector.h"
|
||||
|
||||
//! \addtogroup Containers
|
||||
@@ -598,6 +597,10 @@ public:
|
||||
PIVector<T> * p_;
|
||||
|
||||
public:
|
||||
using ColConst::operator[];
|
||||
using ColConst::data;
|
||||
using ColConst::size;
|
||||
|
||||
//! \~english Accesses the element at the given row index within the column.
|
||||
//! \~russian Доступ к элементу по заданному индексу строки в столбце.
|
||||
//! \return Reference to the element.
|
||||
@@ -618,7 +621,7 @@ public:
|
||||
if (p_ == other.p_ && this->col_ == other.col_) return *this;
|
||||
const size_t sz = piMin<size_t>(this->sz_, other.sz_);
|
||||
for (size_t i = 0; i < sz; ++i)
|
||||
(*p_)[i * this->step_ + this->col_] = other.ColConst::operator[](i);
|
||||
(*p_)[i * this->step_ + this->col_] = other[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -942,7 +945,7 @@ public:
|
||||
inline Index indexOf(const T & e) const {
|
||||
ssize_t flat = mat.indexOf(e);
|
||||
if (flat < 0 || cols_ == 0) return Index{-1, -1};
|
||||
return Index{flat / cols_, flat % cols_};
|
||||
return Index{flat / static_cast<ssize_t>(cols_), flat % static_cast<ssize_t>(cols_)};
|
||||
}
|
||||
|
||||
//! \~english Returns the first index (row, col) in the 2D array that passes the `test`.
|
||||
@@ -951,7 +954,7 @@ public:
|
||||
inline Index indexWhere(std::function<bool(const T & e)> test, ssize_t start = 0) const {
|
||||
ssize_t flat = mat.indexWhere(test, start);
|
||||
if (flat < 0 || cols_ == 0) return Index{-1, -1};
|
||||
return Index{flat / cols_, flat % cols_};
|
||||
return Index{flat / static_cast<ssize_t>(cols_), flat % static_cast<ssize_t>(cols_)};
|
||||
}
|
||||
|
||||
//! \~english Returns the last index (row, col) of `e` in the 2D array.
|
||||
@@ -960,7 +963,7 @@ public:
|
||||
inline Index lastIndexOf(const T & e, ssize_t start = -1) const {
|
||||
ssize_t flat = mat.lastIndexOf(e, start);
|
||||
if (flat < 0 || cols_ == 0) return Index{-1, -1};
|
||||
return Index{flat / cols_, flat % cols_};
|
||||
return Index{flat / static_cast<ssize_t>(cols_), flat % static_cast<ssize_t>(cols_)};
|
||||
}
|
||||
|
||||
//! \~english Returns the last index (row, col) in the 2D array that passes the `test`.
|
||||
@@ -969,7 +972,7 @@ public:
|
||||
inline Index lastIndexWhere(std::function<bool(const T & e)> test, ssize_t start = -1) const {
|
||||
ssize_t flat = mat.lastIndexWhere(test, start);
|
||||
if (flat < 0 || cols_ == 0) return Index{-1, -1};
|
||||
return Index{flat / cols_, flat % cols_};
|
||||
return Index{flat / static_cast<ssize_t>(cols_), flat % static_cast<ssize_t>(cols_)};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user