Swap front for char[] input ranges
RazvanN via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Dec 19 06:09:07 PST 2016
On Monday, 19 December 2016 at 12:25:02 UTC, Ali Çehreli wrote:
> On 12/19/2016 02:41 AM, RazvanN wrote:
> > [...]
>
> As your comments make it clear below, they cannot be
> InputRanges.
>
> > [...]
> swapping code
> > [...]
>
> Obivously, tmp1 and tmp2 are unusued there. :)
>
> > [...]
> passed.
> > [...]
> state
> > [...]
> is:
> > [...]
> input ranges
> > [...]
>
> Not possible... It's ok to use something similar to the
> following template constraint:
>
> void foo(R1, R2)(R1 r1, R2 r2)
> if ((hasSwappableElements!R1 && hasSwappableElements!R2) ||
> (hasLvalueElements!R1 && hasLvalueElements!R2)) {
> // ...
> }
>
> Ali
In this case, the bringToFront function [1] should not accept
char[]
as parameters? Or a special path should be added in the function,
so that char[] are treated specially?
[1]
http://dlang.org/phobos/std_algorithm_mutation.html#bringToFront
More information about the Digitalmars-d-learn
mailing list