On 04/17/2012 08:12 AM, Jakob Ovrum wrote:
> Consider this simple function:
>
> private string findParameterList(string typestr)
> {
> auto strippedHead = typestr.find("(")[1 .. $];
> auto strippedTail = retro(strippedHead).find(")");
>
> strippedTail.popFront(); // slice off closing parenthesis
>
> return array(strippedTail);
> }
>
> The type of the return expression is dstring, not string.

The reason is, a sequence of UTF-8 code units are not a valid UTF-8 when reversed (or retro'ed :p). But a dchar array can be reversed.

Ali

Reply via email to