Skip to content

Commit 429b514

Browse files
committed
fix linear_iterator_traits
1 parent 4ef3cef commit 429b514

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

include/xtensor/xiterable.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,12 @@ namespace xt
284284
template <class D>
285285
struct linear_iterator_traits_impl<D, false>
286286
{
287-
using linear_iterator = typename D::linear_iterator;
288-
using const_linear_iterator = typename D::const_linear_iterator;
289-
using reverse_linear_iterator = typename D::reverse_linear_iterator;
290-
using const_reverse_linear_iterator = typename D::const_reverse_linear_iterator;
287+
using inner_types = xcontainer_inner_types<D>;
288+
using xexpression_type = typename inner_types::xexpression_type;
289+
using linear_iterator = typename xexpression_type::linear_iterator;
290+
using const_linear_iterator = typename xexpression_type::const_linear_iterator;
291+
using reverse_linear_iterator = typename xexpression_type::reverse_linear_iterator;
292+
using const_reverse_linear_iterator = typename xexpression_type::const_reverse_linear_iterator;
291293
};
292294

293295
template <class D>

test/test_xutils.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ namespace xt
140140
xarray<int> x, y;
141141
b = has_storage_type<decltype(x + y)>::value;
142142
EXPECT_FALSE(b);
143+
144+
b = has_storage_type<decltype(view(x, all()))>::value;
145+
EXPECT_TRUE(b);
146+
b = has_storage_type<decltype(view(2*x, all()))>::value;
147+
EXPECT_FALSE(b);
143148
}
144149

145150
TEST(utils, has_strides)

0 commit comments

Comments
 (0)