3 ms·
I was mistaken. I thought you needed std::tuple for structured binding, but it seems the language can also destructure other types.
by deadbeeves 4y ago
I was mistaken. I thought you needed std::tuple for structured binding, but it seems the language can also destructure other types.
- jcelerier 4y agoit's not that you need it, it's that when destructuring, std::tuple_size / std::tuple_element are implicitly checked to see how destructuring can be made to work if you have a type with some custom destructuring. (example: https://gcc.godbolt.org/z/5jq61oox7 https://gcc.godbolt.org/z/5jq61oox7) If they are not available or just not overloaded (e.g. when destructuring some basic struct) it just falls back to the destructuring one expects. So you need <tuple> for the specific case of implementing custom destructuring, that is one more case to add to the list :)
- quest88 4y agoThis whole thread is why c++ is..bad. It just leaves me with a sense of hopelessness.
- deadbeeves 4y agoYou're being overdramatic. You don't need to be a language lawyer to use C++ correctly and effectively.
- jcelerier 4y agoWhich language do you use?
- arinlen 4y ago> This whole thread is why c++ is..bad. It just leaves me with a sense of hopelessness. You've tried to force your personal misconceptions as some kind of gotchas that justify you irrational dislike for a programming language, and once each and every misconception you had was dispelled and debunked, your reaction was to double-down on your irrational belief. This does not flag failures in a language.
- Dylan16807 4y ago? That's their only comment on the entire page.