After an update from #2876, the following code stopped compiling:
auto indexes = xt::xtensor<size_t, 1>{};
auto value_map = xt::xtensor<double, 1>{};
auto f = [&](size_t index) -> auto& { return value_map[index]; };
auto values = xt::vectorize(f)(value_map);
*values.begin();
The reason is in this function:
|
template <class F, class... CT> |
|
inline auto xfunction_stepper<F, CT...>::operator*() const -> reference |
|
{ |
|
return std::apply( |
|
[&](auto&... e) |
|
{ |
|
return (p_f->m_f)(*e...); |
|
}, |
|
m_st |
|
); |
|
} |
Here, the lambda needs to have a return type reference instead of returning by value.
The same problem occurs in every use case of std::apply in xfunction.hpp.
After an update from #2876, the following code stopped compiling:
The reason is in this function:
xtensor/include/xtensor/core/xfunction.hpp
Lines 1108 to 1118 in 5caa64d
Here, the lambda needs to have a return type
referenceinstead of returning by value.The same problem occurs in every use case of std::apply in xfunction.hpp.