C++'s std::rotate

Dragos Carp via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 11 03:27:39 PDT 2014


On Monday, 11 August 2014 at 10:09:53 UTC, Nordlöw wrote:
> On Monday, 11 August 2014 at 06:56:52 UTC, Dragos Carp wrote:
>> bool sliceOf(T)(in T[] whole, in T[] slice)
>> {
>>    return whole.ptr <= slice.ptr &&
>>        whole.ptr + slice.length <= whole.ptr + slice.length;
>> }
>
> Correction: This is what I think you mean:
>
> bool sliceOf(T)(in T[] part,
>                 in T[] whole)
> {
>     return (whole.ptr <= part.ptr &&
>             part.ptr + part.length <=
>             whole.ptr + whole.length);
> }

Yes, of course. I had lhs, rhs and messed up the renaming of 
those.


More information about the Digitalmars-d mailing list