Operator overloading
The Anh Tran
trtheanh at gmail.com
Fri Dec 26 16:42:11 PST 2008
aarti_pl wrote:
> Andrei Alexandrescu pisze:
> > We're trying to make that work. D is due for an operator overhaul.
> >
> > Andrei
>
> Is there any chance that we get possibility to overload "raw operators",
> like in C++? I think that they may coexist with currently defined
> operator overloads with simple semantic rules, which will not allow them
> to work together at the same time.
> ..........
> BR
> Marcin Kuszczak
> (aarti_pl)
Me also have a dream :D
<Daydream mode>
class Foo
{
auto op(++)(); // bar++
auto op(++)(int); // ++bar
op(cast)(uint); // cast(uint)bar // opCast
auto op(())(int, float); // Foo(123, 123.456) // opCall
auto op(+)(Foo rhs); // bar1 + bar2
auto op(+=)(int); // bar += 1234;
auto op(.)(); // bar.xyz // opDot
Foo op([][][])(int, char, float); // bar[123]['x'][123.456]
auto op([..])(); // i = bar2[] // opSlide
auto op([..])(int, int); // bar[1..10]
auto op([..]=)(float); // bar[] = 12.3 //opSlideAssign
auto op([..]=)(int, int, float); // bar[1..3] = 123.4
}
</Dream>
More information about the Digitalmars-d
mailing list