>const MemoryAddress_ operator+(const MemoryAddress_&left){
> MemoryAddress_ result = *this;
> result+=left;
> return result;
>}
Thanks for that.
// Naderan *Mahmood;
----- Original Message ----
From: Djordje Jevdjic <[email protected]>
To: "[email protected]" <[email protected]>
Cc: "[email protected]" <[email protected]>
Sent: Thu, April 14, 2011 4:07:17 PM
Subject: RE: Adding two VirtualMemoryAddress variables
Dear Mahmood,
There is no need to define an operator that sums two memory addresses. That's
why we don't have
it in Flexus (I can't think of any use case). Anyhow, if you need an operator
for something like
a=b+c where a, b and c some memory address variables, you can use this code
snippet:
const MemoryAddress_ operator+(const MemoryAddress_&left){
MemoryAddress_ result = *this;
result+=left;
return result;
}
However, if you use something like a=b+4L, I guess that compiler will complain
about ambiguity, because
this can be understood as an addition of two numbers (considering b as a
number). If you want to
use it in this context (again, I don't see why you would want to do so), you
can
use something like this:
a=b;
a+=4L;
Regards,
Djordje
From: Mahmood Naderan <[email protected]<mailto:[email protected]>>
Date: April 8, 2011 7:48:33 AM GMT+02:00
To: Onur Koçberber <[email protected]<mailto:[email protected]>>
Cc: simflex <[email protected]<mailto:[email protected]>>
Subject: Re: Adding two VirtualMemoryAddress variables
'+' operator is already overloaded to sum two memory addresses in Flexus.
There is no '+' in my flexus 4.0. If you mean types.hpp, there are '+=' , '-=' ,
'==' , '=' , '<'
// Naderan *Mahmood;
----- Original Message ----
From: Onur Koçberber <[email protected]<mailto:[email protected]>>
To: simflex <[email protected]<mailto:[email protected]>>
Sent: Fri, April 8, 2011 3:21:34 AM
Subject: Re: Adding two VirtualMemoryAddress variables
Dear Mahmood,
'+' operator is already overloaded to sum two memory addresses in Flexus.
Please do not overload this operator. If you need any other functionality than
this, you can define your own operator.
Regards,
Onur
________________________________________
From: Mahmood Naderan [[email protected]]
Sent: Saturday, March 12, 2011 4:05 PM
To: simflex
Subject: Adding two VirtualMemoryAddress variables
Hi,
I have defined an overloaded '+' operator in types.hpp like this:
const MemoryAddress_& operator+ (underlying_type const & left) const {
MemoryAddress_ result = *this;
result += left;
return result;
}
It is similar to other overloaded operators. However when I use it to add two
VirtualMemoryAddress variables it says:
error: ambiguous overload for ‘operator+’ in ‘add1 + add2’
note: candidates are: operator+(long long int, long long int) <built-in>
/home/mahmood/flexus-4.0/core/types.hpp:97: note: const
Flexus::Core::MemoryAddress_<underlying_type, isVirtual>&
Flexus::Core::MemoryAddress_<underlying_type, isVirtual>::operator+(const
underlying_type&) const [with underlying_type = long long int, bool
isVirtual = true]
/opt/boost_1_33_1/boost/operators.hpp:250: note:
Flexus::Core::MemoryAddress_<long long int, true> boost::operator+(const int&,
const
Flexus::Core::MemoryAddress_<long long int, true>&)
/opt/boost_1_33_1/boost/operators.hpp:250: note:
Flexus::Core::MemoryAddress_<long long int, true> boost::operator+(const
Flexus::Core::MemoryAddress_<long long int, true>&, const int&)
Seems that it conflict with the overloaded '+' in boost. Has anybody faced
such issue?
Thanks,
--
// Naderan *Mahmood;