Don't allow indexing util::array with wrong number of indices
This commit is contained in:
parent
70f3b68077
commit
05608cc17c
1 changed files with 2 additions and 0 deletions
|
|
@ -345,6 +345,7 @@ namespace psemek::util
|
|||
std::enable_if_t<detail::is_index_v<Ixs...>, T &>
|
||||
array<T, N>::operator()(Ixs ... ixs)
|
||||
{
|
||||
static_assert(sizeof...(Ixs) == N);
|
||||
dims_type dims{static_cast<std::size_t>(ixs)...};
|
||||
return (*this)(dims);
|
||||
}
|
||||
|
|
@ -354,6 +355,7 @@ namespace psemek::util
|
|||
std::enable_if_t<detail::is_index_v<Ixs...>, T const &>
|
||||
array<T, N>::operator()(Ixs ... ixs) const
|
||||
{
|
||||
static_assert(sizeof...(Ixs) == N);
|
||||
dims_type dims{static_cast<std::size_t>(ixs)...};
|
||||
return (*this)(dims);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue