Do pure functions solve the "return const" problems?

Janice Caron caron800 at googlemail.com
Tue Apr 1 11:17:28 PDT 2008


On 01/04/2008, Russell Lewis <webmaster at villagersonline.com> wrote:
>  BEGIN CODE
>         pure char[] strstr(char[] haystack, char[] needle)
>         {
>                 // perform the search
>                 int indx = <whatever>
>
>                 return haystack[indx..$];
>         }
>  END CODE
>
>  Thoughts?
>         Russ

Just one...

    char[] s;
    string t;
    auto u = strstr(s,t);

What type is u?

(The alternative solution proposed by Stephen and myself solves this
problem completely, by the way).



More information about the Digitalmars-d mailing list