Walter Bright wrote:
Steven Schveighoffer wrote:
On Tue, 20 Jul 2010 15:21:34 -0400, Walter Bright
<newshou...@digitalmars.com> wrote:
Steven Schveighoffer wrote:
The omission of dchar is on purpose. Phobos has characterized
string as a bidirectional range of dchars. For every range where I do:
foreach(e; range)
e is of the type of the range. Except for char and wchar. This
schizophrenia of type induction is very bad for D, and it's a good
argument of why strings should not simply be arrays.
For many algorithms on strings, iterating by char is preferred over
dchar, even for multibyte strings.
Huh? Which ones?
Searching, for one.
AFAIK, all of std.algorithm treats strings as ranges of dchar.
Andrei posted elsewhere that there were specializations for strings to
do it one way or the other based on which was more efficient.
Boyer-Moore comes to mind.
Andrei