Add of std::valarray
got different sizes with different operand orders.
Code is as the following:
#include <iostream>
#include <valarray>
using namespace std;
int main() {
std::valarray<float> v0{3.f, 0.f};
std::valarray<float> v1{0.f};
std::valarray<float> v2 = v0 + v1;
std::valarray<float> v3 = v1 + v0;
cout << v2.size() << endl; // 2
cout << v3.size() << endl; // 1
}
Compilers:
g++ (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
clang version 9.0.0-2~ubuntu18.04.2 (tags/RELEASE_900/final)