mattkretz / wg21-papers

my papers to WG21 — the C++ committee
5 stars 7 forks source link

conversion between datapar and std::array #49

Closed mattkretz closed 7 years ago

mattkretz commented 7 years ago

Testcase

std::array<float, 8> data = {};
datapar<float, avx> x(data);  // ill-formed
datapar<float, fixed_size<8>> y(data);  // compiles with the Vc implementation
// but no guarantee that it will compile for other implementations of P0214

Expected Results

std::array is too common a type, therefore the above needs more thought. Maybe fixed_size datapars (and masks) should have conversion to/from std::array in P0214 proper. I still believe that native ABIs should not have it. Alternative: disallow std types as "native_handle" types.

brycelelbach commented 7 years ago

I don't love that this compiles in some places but not others. But, if it's just a conforming extension, I guess I'd be okay with it (e.g. if we just don't explicitly say anything about it).

I usually strongly favor consistency, so I may be biased.

mattkretz commented 7 years ago

I'm tending towards treating this as a QoI issue. It's still a conforming extension, but in general, the conversion to/from std::array should not work.

I'll propose to_bitset and from_bitset or similar for mask (see #52) at some later point. In the same manner it may be useful to have a to_array and from_array for datapar.