On 5/23/16 6:22 PM, Andrei Alexandrescu wrote:
On 05/23/2016 04:27 PM, Steven Schveighoffer wrote:
On 5/23/16 4:01 PM, Andrei Alexandrescu wrote:
So swap(a, b) swaps the contents of a and b. This could be easily
generalized to multiple arguments such that swap(a1, a2, ..., an)
arranges things such that a1 gets an, a2 gets a1, a3 gets a2, etc. I do
know applications for three arguments. Thoughts? -- Andrei
One thing that screams out to me: this should be called rotate, not swap.
Problem is the usefulness peaks at 2-3 args, and for 2 and 3 arguments
"rotate" is overkill. -- Andrei
OK, let me rephrase. For 3 arguments, swap is a totally unintuitive name :)
I personally think rotate is fine, is describing pretty much exactly
what is happening, and scales well. But I guess there is some existing
meaning in Phobos for it, so that may not fly.
-Steve