C++'s std::rotate

"Nordlöw" via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 11 03:09:51 PDT 2014


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);
}


More information about the Digitalmars-d mailing list