C++'s std::rotate

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 19 14:26:38 PDT 2014


On 8/19/14, 12:32 PM, Fool wrote:
> On Monday, 18 August 2014 at 05:27:11 UTC, Andrei Alexandrescu wrote:
>> On 8/17/14, 9:06 AM, Fool wrote:
>>>  http://dpaste.dzfl.pl/8fc83cb06de8
>>
>> Yah, it's a good option. Relevant code:
>>
>> if (right is whole)
>> {
>>     //writeln("case identical");
>>     return tuple(right, whole.dropExactly(whole.length));
>> }
>>
>> (Prolly it would be better to use "whole.sameHead(right)" instead of
>> "right is whole". Also whole may not define length so the actual algo
>> is just a tad different.)
>
> A cleaned-up version is here: http://dpaste.dzfl.pl/a8c36a0c36d0

FWIW just added https://issues.dlang.org/show_bug.cgi?id=13335

Andrei


More information about the Digitalmars-d mailing list