Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Feb 19, 2018
1 parent 2c8f97c commit a0e7b00
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions include/xtensor/xview.hpp
Expand Up @@ -202,7 +202,7 @@ namespace xt
mutable strides_type m_strides;
mutable bool m_strides_computed;

void compute_strides() const;
strides_type compute_strides() const;

template <typename std::decay_t<CT>::size_type... I, class... Args>
reference access_impl(std::index_sequence<I...>, Args... args);
Expand Down Expand Up @@ -618,7 +618,8 @@ namespace xt
{
if (!m_strides_computed)
{
compute_strides();
m_strides = compute_strides();
m_strides_computed = true;
}
return m_strides;
}
Expand Down Expand Up @@ -716,9 +717,9 @@ namespace xt
//@}

template <class CT, class... S>
inline void xview<CT, S...>::compute_strides() const
inline auto xview<CT, S...>::compute_strides() const -> strides_type
{
m_strides = xtl::make_sequence<strides_type>(dimension(), 0);
strides_type strides = xtl::make_sequence<strides_type>(dimension(), 0);

auto func = [](const auto& s) { return xt::step_size(s); };
size_type i = 0, idx;
Expand All @@ -730,14 +731,13 @@ namespace xt
{
break;
}
m_strides[i] = m_e.strides()[idx - newaxis_count_before<S...>(i)] * apply<size_type>(idx, func, m_slices);
strides[i] = m_e.strides()[idx - newaxis_count_before<S...>(i)] * apply<size_type>(idx, func, m_slices);
}
for (; i < m_strides.size(); ++i)
for (; i < strides.size(); ++i)
{
m_strides[i] = m_e.strides()[idx++];
strides[i] = m_e.strides()[idx++];
}

m_strides_computed = true;
return strides;
}

template <class CT, class... S>
Expand Down

0 comments on commit a0e7b00

Please sign in to comment.