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
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
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 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. Other
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 I
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
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)
{
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)
{
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;
}