Fix abuse of array2D<>

- Add copy c'tor and assignment to `array2D<>`
- Use `std::vector<>` instead of smart pointer to array
- Constify a bit
- Make use of `rtengine::max(...)`
This commit is contained in:
Flössie
2020-08-16 11:22:10 +02:00
parent 231c5e2c99
commit 3af822b6f7
3 changed files with 59 additions and 51 deletions

View File

@@ -64,8 +64,7 @@ constexpr unsigned int ARRAY2D_BYREFERENCE = 2;
template<typename T>
class array2D :
public rtengine::NonCopyable
class array2D
{
private:
@@ -125,6 +124,25 @@ public:
}
}
array2D(const array2D& other) :
width(other.width),
buffer(other.buffer)
{
initRows(other.rows.size());
}
array2D& operator =(const array2D& other)
{
if (this != &other) {
free();
width = other.width;
buffer = other.buffer;
initRows(other.rows.size());
}
return *this;
}
void fill(const T val, bool multiThread = false)
{
const ssize_t height = rows.size();