On Tue, 20 Jul 2010 16:08:06 +0200, Jesse Phillips <jesse.k.phill...@gmail.com> wrote:

But then you can't overload operators.

On Tue, Jul 20, 2010 at 12:54 AM, Rory McGuire <rmcgu...@neonova.co.za> wrote:
On Tue, 20 Jul 2010 01:51:51 +0200, Jesse Phillips
<jessekphillip...@gmail.com> 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)[]

You shouldn't need to do that:

string strstr(string haystack, string needle);

can be used as:

string s;
s.strstr("needle");

so you can add "methods" to a string or whatever just by defining functions.

-Rory





such as?

Reply via email to