function overload on full signature?

Tove tove at fransson.se
Tue Nov 13 23:26:41 PST 2012


On Wednesday, 14 November 2012 at 06:52:57 UTC, Rob T wrote:
> On Wednesday, 14 November 2012 at 02:01:56 UTC, Jonathan M 
> Davis wrote:
> Is there anything like C++ conversion operators in D? I have 
> used conversion ops in C++ and may want to use a similar 
> feature in D if available.
> --rt

it would be a very useful feature to allow overload on void and 1 
other type... as sometimes the return is very expensive to 
calculate... I have seen this trick used by compiler build-in 
functions.

struct A
{
   int i;
   string s;

   alias i this;
   alias s this;
}

but... 2 alias this are not currently allowed.



More information about the Digitalmars-d mailing list