Can't use std.algorithm.remove on a char[]?

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 30 12:21:30 PDT 2016


On 30.04.2016 21:08, Jon D wrote:
> If an initial step is to fix the documentation, it would be helpful to
> include specifically that it doesn't work with characters. It's not
> obvious that characters don't meet the requirement.

Characters are not the problem. remove works fine on a range of chars, 
when the elements are assignable lvalues. char[] as a range has neither 
assignable elements, nor lvalue elements. That is, lines 3 and 4 here 
don't compile:
----
import std.range: front;
char[] a = ['f', 'o', 'o'];
a.front = 'g';
auto ptr = &a.front;
----




More information about the Digitalmars-d-learn mailing list