I tried to unpack a std::array
via std::tie
:
#include <tuple>
#include <array>
int main() {
std::array<int, 3> arr = {1, 2, 3};
int a, b, c;
std::tie(a, b, c) = arr;
return 0;
}
This works in clang, but fails to compile in g++ 5.4: no match for ‘operator=’
. Compile options are -std=c++11
.
- Why does this work in clang but not g++?
- How can I portably unpack a
std::array
, like one might unpack a tuple?
Thanks for any help!
Aucun commentaire:
Enregistrer un commentaire