Skip to content
Snippets Groups Projects
Commit 2db7c572 authored by patavirt's avatar patavirt
Browse files

array: disallow default construction again

parent eba4d478
No related branches found
No related tags found
No related merge requests found
......@@ -316,19 +316,7 @@ protected:
}
};
void data_null_check() const
{
if constexpr(BoundsCheck) {
if (data_ == nullptr)
throw std::out_of_range("data is null");
}
}
public:
ArrayView()
: Base(), data_(nullptr)
{}
ArrayView(const std::enable_if<Shape::fixed, ArrayView<Scalar,Shape,Alignment,BoundsCheck> >& other)
: Base(), data_(other.data_)
{}
......@@ -386,8 +374,6 @@ public:
static_assert(sizeof...(idxs) <= Shape::ndim,
"number of indices must be smaller than the number of dimensions");
data_null_check();
const std::array<size_t, Shape::ndim> m{idxs...};
size_t idx = 0;
......@@ -439,7 +425,6 @@ public:
EigenMap matrix() const
{
static_assert(Shape::ndim == 2, "matrix must be two-dimensional");
data_null_check();
return {data_, static_cast<Eigen::Index>(Base::dim(0)), static_cast<Eigen::Index>(Base::dim(1))};
}
......@@ -456,7 +441,6 @@ public:
reshape() const
{
static_assert(Shape::size == detail::ShapeType<Dims...>::size, "incompatible shapes");
data_null_check();
return {data(), Base::size()};
}
......@@ -467,7 +451,6 @@ public:
reshape(const std::array<size_t, detail::ShapeType<Dims...>::ndim> shape) const
{
static_assert(Shape::size == detail::ShapeType<Dims...>::size, "incompatible shapes");
data_null_check();
return {data(), Base::size(), shape};
}
......@@ -476,8 +459,6 @@ public:
{
const size_t n = Base::size();
data_null_check();
for (size_t i = 0; i < n; ++i)
data_[i] = value;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment