Namespaces
Variants
Actions

Talk:cpp/utility/tuple/operator=

From cppreference.com
< Talk:cpp‎ | utility‎ | tuple

Does anyone know what the deal is with these C++23 overloads? I know they come with the zip proposal, but I can't rationalise making const tuples assignable/swappable --Ybab321 (talk) 11:38, 26 February 2022 (PST)

some background is here: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2214r0.html#a-tuple-that-is-writable --Cubbi (talk) 12:53, 26 February 2022 (PST)
Thanks, I see how it is now. I had a suspicion that the reason for related to proxy types, but figured "well vector<bool>'s subscript operator returns a proxy type that isn't assignable when const, so it's probably not that", but it turns out it really is for proxy support, and all proxy types should now be assignable even if const, as is formalised by std::indirectly_writable. Also std::vector<bool>::reference::operator= has been changed to be const-assignable accordingly, so fair enough. I guess assignment to const makes sense now sometimes... and tuple of course needs to respect that. --Ybab321 (talk) 13:33, 26 February 2022 (PST)