-
Notifications
You must be signed in to change notification settings - Fork 427
Open
Description
Hello,
I am using xtensor 0.26.0 and the following code snipped adapted from the documentation:
template <class E, xt::enable_xexpression<E, bool> = true>
auto cos_plus_sin(E&& expr) {
auto shared_expr = xt::make_xshared(std::forward<E>(expr));
return xt::sin(shared_expr) + xt::cos(shared_expr);
}None of the following three code snipped can be compiled successfully:
const xt::xtensor<float, 1> x{1, 2, 4, 8};
std::cout << x << std::endl;
std::cout << cos_plus_sin(x) << std::endl;complains about incompatible cv-qualifiers.
xt::xtensor<float, 1> x{1, 2, 4, 8};
std::cout << x << std::endl;
std::cout << cos_plus_sin(x) << std::endl;complains that cannot bind rvalue reference to lvalue.
std::cout << xt::arange<float>(0, 4) << std::endl;
std::cout << cos_plus_sin(xt::arange<float>(0, 4)) << std::endl;complains as the following:
/usr/include/xtensor/core/xexpression.hpp:575:9: error: ‘class xt::xgenerator<xt::detail::arange_generator<float, float, float>, float, std::array<long unsigned int, 1> >’ has no member named ‘linear_begin’
575 | XTENSOR_FORWARD_METHOD(linear_begin)
| ^
/usr/include/xtensor/core/xexpression.hpp:576:9: error: ‘class xt::xgenerator<xt::detail::arange_generator<float, float, float>, float, std::array<long unsigned int, 1> >’ has no member named ‘linear_end’
576 | XTENSOR_FORWARD_METHOD(linear_end)
| ^
So, how the function from the documentation is supposed to be implemented for all this pretty valid scenarios?
Metadata
Metadata
Assignees
Labels
No labels