After finding out you can ergonomically convert std::vector
s into fix-sized std::span
s, I thought I'd try out structured bindings for std::vector
:
auto _ = std::vector{ 1,2,3 };
std::span<int, 3> a = std::span(_).first<3>();
auto [b,c,d] = a;
But it's not working https://godbolt.org/z/nhrYn65dW
However, it seems from P1024 Usability Enhancements for std::span which was accepted that this should be legal
Add structured binding support for fixed-size span? Unanimous consent