Skip to content

Commit 118f1e3

Browse files
committed
Array2DRef shall not be default-constructible
1 parent 707efff commit 118f1e3

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/librawspeed/adt/Array2DRef.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
namespace rawspeed {
3232

3333
template <class T> class Array2DRef final {
34-
T* _data = nullptr;
35-
int _pitch = 0;
34+
T* _data;
35+
int _pitch;
3636

3737
friend Array2DRef<const T>; // We need to be able to convert to const version.
3838

@@ -46,10 +46,10 @@ template <class T> class Array2DRef final {
4646
using value_type = T;
4747
using cvless_value_type = std::remove_cv_t<value_type>;
4848

49-
int width = 0;
50-
int height = 0;
49+
int width;
50+
int height;
5151

52-
Array2DRef() = default;
52+
Array2DRef() = delete;
5353

5454
Array2DRef(T* data, int width, int height, int pitch = 0);
5555

@@ -125,11 +125,6 @@ Array2DRef<T>::Array2DRef(T* data, const int width_, const int height_,
125125
template <class T>
126126
[[nodiscard]] inline Optional<Array1DRef<T>>
127127
Array2DRef<T>::getAsArray1DRef() const {
128-
// FIXME: this might be called for default-constructed `Array2DRef`,
129-
// and it really doesn't work for them.
130-
if (!_data)
131-
return std::nullopt;
132-
133128
establishClassInvariants();
134129
if (height == 1 || _pitch == width)
135130
return {{_data, width * height}};

0 commit comments

Comments
 (0)