Support indexing zero-dimensional matrices
This commit is contained in:
parent
6d22ae95c7
commit
7698e54b18
2 changed files with 4 additions and 2 deletions
|
|
@ -27,6 +27,8 @@ namespace psemek::geom::detail
|
||||||
{
|
{
|
||||||
T const & operator[](std::size_t) const { throw empty_array_exception{}; }
|
T const & operator[](std::size_t) const { throw empty_array_exception{}; }
|
||||||
T & operator[](std::size_t) { throw empty_array_exception{}; }
|
T & operator[](std::size_t) { throw empty_array_exception{}; }
|
||||||
|
|
||||||
|
type operator + (std::size_t) const { return *this; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,12 @@ namespace psemek::geom
|
||||||
|
|
||||||
detail::array<T, R * C>::type coords;
|
detail::array<T, R * C>::type coords;
|
||||||
|
|
||||||
T * operator[](std::size_t i)
|
auto operator[](std::size_t i)
|
||||||
{
|
{
|
||||||
return coords + C * i;
|
return coords + C * i;
|
||||||
}
|
}
|
||||||
|
|
||||||
T const * operator[](std::size_t i) const
|
auto operator[](std::size_t i) const
|
||||||
{
|
{
|
||||||
return coords + C * i;
|
return coords + C * i;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue