Idea: swap with multiple arguments

Q. Schroll via Digitalmars-d digitalmars-d at puremagic.com
Mon May 23 14:26:15 PDT 2016


On Monday, 23 May 2016 at 20:27:43 UTC, 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.
>
> -Steve

Just name Andrei's function rotate and make swap just an alias of 
it with exactly two parameters. No confusion and everyone is 
happy.


More information about the Digitalmars-d mailing list