Dan:
> I'm still really sceptic, especially because they look to me inconsistent to
> each
> other.
Yes, they seem divided in two groups, with different level of complexity, etc.
This is true, and I think this is by design, opCmp and opEquals and few others
are useful in many classes. While ove
I'm still really sceptic, especially because they look to me inconsistent to
each
other.
for example
opBinary(string op:"something here")(Object other)
and then ther is
opCmp(Obejct other)
which is not template and there is only one for all these operators < <= > >=
Did I understand correctly? if
On Mon, 03 May 2010 14:28:20 +, Dan wrote:
> it certainly helps. However I can't help myself, I still thinking that
> this is the most complicated, hard read and to understand way to
> overload operators. Maybe there is something I'm missing but I can't
> really see the reason of all that. Othe
On Mon, 03 May 2010 16:46:41 +, Lars T. Kyllingstad wrote:
> [...]
>
> Pair opBinary(string op)(Pair p)
> {
> auto r = this;
> r.opOpAssign!op(p);
Sorry, that last line should be:
r.opOpAssign!(op~"=")(p);
-Lars
On 05/03/2010 04:28 PM, Dan wrote:
Hi,
it certainly helps. However I can't help myself, I still thinking that this is
the most complicated, hard read and to understand way to
overload operators. Maybe there is something I'm missing but I can't really see
the reason of all that. Other languages
Hi,
it certainly helps. However I can't help myself, I still thinking that this is
the most complicated, hard read and to understand way to
overload operators. Maybe there is something I'm missing but I can't really see
the reason of all that. Other languages adopts a much
easier approach, for e
On 02/05/10 07:14, Dan wrote:
Hi everyone,
is there anyway to do this with operators overloading? :
The following code does it:
class Tester
{
double x = 0.0;
T opBinary(string op:"+", T)(T value) if(is(T : double))
{
return x+value;
}
Dan wrote:
Hi everyone,
is there anyway to do this with operators overloading? :
class Tester
{
double x = 0.0;
double opBinary(string op:"+")(double value)
{
return x+value;
}
Tester opBinary(string op:"+")(Tester other)
{