In reading this summary of the c++17 final features I was a bit surprised by the section on structured bindings (emphasis mine):
structured bindings
Until now, there was a known trick to abuse std::tie to assign a tuple or pair to different variables directly, instead of having to deal with the result type manually. This was a hack, and also the variables had to exist, now you can declare the variables and initialize them in one line:
auto [a , b , c] = getvalues();
The braces are needed, getvalues returns a tuple. std::pair is not mentioned in the proposal, so its unclear if this works with pair, which is returned by the STL in some insert methods.
I am assuming they refer to this kind of usage of std::tie
int a,b,c;
std::tie(a,b,c) = std::make_tuple(1,2,3);
which I believed to be a recommended practice.
Can someone offer an explanation as to why they are referring to above example as a hack?