By disallowing a binding of simd<>::reference to an lvalue the code below (ref. https://godbolt.org/z/7qW8bffe5) becomes clumsy:
#include <iostream>
#include <experimental/simd>
namespace stdx = std::experimental;
void foo(auto&& x)
{
std::forward<decltype(x)>(x) = .2;
//x = .3;
}
int main()
{
stdx::simd<double> x = 0;
x[0] = .1;
foo(x[1]);
for (int i = 0; i < x.size(); ++i) std::cout << x[i] << ' ';
}
The x = .3 clause doesn't compile, since the assignment is declared as reference::operator=(...) && and x is an lvalue. Why is the operator= restricted to rvalues?
Is it known, that the above code becomes clumsy by this restriction?