Proposal
I read this a while ago and it sounds like an incredible idea. But, obviously, it hasn't made it into C++14, and it doesn't even seem to be coming to C++17. What's the reasoning?
For background, the paper you've linked to proposes adding operator:=:
to the language to accomplish what the following does today
using std::swap;
swap(a, b);
Instead you'd write,
a :=: b;
This is tracked by EWG issue 54 and was rejected as not a defect because the technique of using unqualified calls to swap
will persist despite the new operator because without it, all user defined swap
functions will be rendered useless. Moreover, adding the operator does not remove the need for having to rely on ADL to find the type specific swap
implementation, if one exists.
Quoting Bjarne from the link above:
But
swap()
isn't going away because of backward compatibility, so now we'll haveswap()
andoperator:=:
. "Probably a good idea if we had a time machine". Introducing a new operator, it has to be really central and helpful. If it got us out of our swap problem it might be good enough, but it isn't. Libraries aren't going to stop calling swap and if they did then all the specialized swap functions people have written wouldn't get invoked. Problems are real, but the benefits it would have (i.e. what problem it would actually solve) aren't sufficiently explained. Too likely thatswap
and:=:
would coexist indefinitely and that all the problems of swap would persist.General agreement that this is a real problem but that it's not clear why this would solve them. We will not proceed with this.
No recommendation to move forward, considered NAD.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With