check Ndim on drop_first_dim

This commit is contained in:
froejdh_e
2025-07-25 11:44:27 +02:00
parent 1527a45cf3
commit 89bb8776ea

View File

@@ -35,6 +35,7 @@ Shape<Ndim> make_shape(const std::vector<size_t> &shape) {
*/ */
template<size_t Ndim> template<size_t Ndim>
Shape<Ndim-1> drop_first_dim(const Shape<Ndim> &shape) { Shape<Ndim-1> drop_first_dim(const Shape<Ndim> &shape) {
static_assert(Ndim > 1, "Cannot drop first dimension from a 1D shape");
Shape<Ndim - 1> new_shape; Shape<Ndim - 1> new_shape;
std::copy(shape.begin() + 1, shape.end(), new_shape.begin()); std::copy(shape.begin() + 1, shape.end(), new_shape.begin());
return new_shape; return new_shape;