Why doesn't the below code compile?
How to rewrite it so that it does?
Using: DMD64 D Compiler v2.060.
Thank you.

Code:
----------------

import std.algorithm, std.ascii, std.stdio;

void main()
{
      char[] rot13 = lowercase.dup;

      bringToFront(rot13[0 .. 13], rot13[13 .. $]);
      writeln(rot13);
}

----------------

Errors:

/usr/include/dmd/phobos/std/algorithm.d(1762): Error: front(r1)
is not an lvalue
/usr/include/dmd/phobos/std/algorithm.d(1763): Error: r2.front is
not an lvalue
/usr/include/dmd/phobos/std/algorithm.d(5944): Error: template
instance std.algorithm.swapFront!(char[],char[]) error
instantiating
rot13_test.d(7):        instantiated from here:
bringToFront!(char[],char[])
/usr/include/dmd/phobos/std/algorithm.d(1762): Error: not a
property r1.front
/usr/include/dmd/phobos/std/algorithm.d(1763): Error: r2.front is
not an lvalue
/usr/include/dmd/phobos/std/algorithm.d(5944): Error: template
instance std.algorithm.swapFront!(Take!(char[]),char[]) error
instantiating
/usr/include/dmd/phobos/std/algorithm.d(5973):
instantiated from here: bringToFront!(Take!(char[]),char[])
rot13_test.d(7):        instantiated from here:
bringToFront!(char[],char[])
/usr/include/dmd/phobos/std/algorithm.d(5973): Error: template
instance std.algorithm.bringToFront!(Take!(char[]),char[]) error
instantiating
rot13_test.d(7):        instantiated from here:
bringToFront!(char[],char[])
rot13_test.d(7): Error: template instance
std.algorithm.bringToFront!(char[],char[]) error instantiating

Reply via email to