On Mon, 19 Jul 2010 20:26:47 -0400, Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:

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).

How do we make this work?

auto str = "hello world";
foreach(c; str)
   assert(is(typeof(c) == dchar));

-Steve

Reply via email to