fix(math): use decltype(auto) instead of auto
This commit is contained in:
@@ -51,7 +51,7 @@ public:
|
||||
template <typename... Offs,
|
||||
typename = std::enable_if_t<(
|
||||
sizeof...(Offs) > 0 && sizeof...(Offs) <= sizeof...(Dims) && (std::is_integral_v<Offs> && ...))>>
|
||||
auto slice(Offs... offs) {
|
||||
decltype(auto) slice(Offs... offs) {
|
||||
auto* ptr = m_view + calculate_offset(std::make_tuple(offs...));
|
||||
if constexpr (sizeof...(Offs) == sizeof...(Dims)) return *ptr;
|
||||
return inner_view<T, sizeof...(Offs)>(ptr, std::index_sequence<Dims...>{});
|
||||
@@ -60,19 +60,19 @@ public:
|
||||
template <typename... Offs,
|
||||
typename = std::enable_if_t<(
|
||||
sizeof...(Offs) > 0 && sizeof...(Offs) <= sizeof...(Dims) && (std::is_integral_v<Offs> && ...))>>
|
||||
auto slice(Offs... offs) const {
|
||||
decltype(auto) slice(Offs... offs) const {
|
||||
const auto* ptr = m_view + calculate_offset(std::make_tuple(offs...));
|
||||
if constexpr (sizeof...(Offs) == sizeof...(Dims)) return *ptr;
|
||||
return inner_view<const T, sizeof...(Offs)>(ptr, std::index_sequence<Dims...>{});
|
||||
}
|
||||
public:
|
||||
template <typename Off, typename = std::enable_if_t<std::is_integral_v<Off>>>
|
||||
auto operator[](Off off) {
|
||||
decltype(auto) operator[](Off off) {
|
||||
return slice(off);
|
||||
}
|
||||
|
||||
template <typename Off, typename = std::enable_if_t<std::is_integral_v<Off>>>
|
||||
auto operator[](Off off) const {
|
||||
decltype(auto) operator[](Off off) const {
|
||||
return slice(off);
|
||||
}
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user