Skip to content

Commit 3127ecc

Browse files
authored
Merge pull request #2371 from gouarin/view-perf
fix data_offset method in xview to compute the strides only once
2 parents b7a8cd0 + 1855d5f commit 3127ecc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/xtensor/xview.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ namespace xt
534534
template <class T = xexpression_type>
535535
std::enable_if_t<has_data_interface<T>::value && is_strided_view, const_storage_iterator>
536536
storage_end() const;
537-
537+
538538
template <class T = xexpression_type>
539539
std::enable_if_t<has_data_interface<T>::value && is_strided_view, const_storage_iterator>
540540
storage_cbegin() const;
@@ -1331,6 +1331,7 @@ namespace xt
13311331
if (!m_strides_computed)
13321332
{
13331333
compute_strides(std::integral_constant<bool, has_trivial_strides>{});
1334+
m_strides_computed = true;
13341335
}
13351336
return m_data_offset;
13361337
}

0 commit comments

Comments
 (0)