Higher level built-in strings

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 19 17:26:47 PDT 2010


On 07/19/2010 06:51 PM, Jesse Phillips wrote:
> What about:
>
> struct String {
> 	string items;
> 	alias items this;
> }
>
> And add the needed functions you wish to have in string and it will still work in existing functions that operate on immutable(char)[]

Fortunately you can essentially achieve the above by simply writing free 
functions that take a string or a ref string as their first argument. 
Then you can use str.foo(args) as an alternative for foo(str, args).

Andrei


More information about the Digitalmars-d mailing list