T
Toto
Hello,
I've got a problem with the redefinition of operator in C++. My intent
is to create a TVector that internally work with __int64, with an
external interface of double in order to optimize the operations. The
double value put in input should be muliplied with factor 1e10, in
order to limit
the loss of precision and divided with the same quantity in output.
To make this, I've supposed to can modify the operator() for the access
at the singular element of a Vector.
My test Vector class is like this
class Vector
{
private:
__int64 *Array;
public:
inline __int64& TVector:perator()(byte Index) {if(Index>FDim) throw
Exception("Out of bound Exception");return
(__int64)Array[Index]*1e10;};
};
In the program:
double Value = 3.43;
Vector V(3);
V(1) = Value:// Internally V.Array[1] =3.43e10;
V(1)=V(1)+1;
Value = V(1); // Value=4.43;
Obviously the adopted solution does not work as I hope. Please, could
someone help me with any kind of advise? I hope to have explain in good
way the problem.
Thanks in advance.
I've got a problem with the redefinition of operator in C++. My intent
is to create a TVector that internally work with __int64, with an
external interface of double in order to optimize the operations. The
double value put in input should be muliplied with factor 1e10, in
order to limit
the loss of precision and divided with the same quantity in output.
To make this, I've supposed to can modify the operator() for the access
at the singular element of a Vector.
My test Vector class is like this
class Vector
{
private:
__int64 *Array;
public:
inline __int64& TVector:perator()(byte Index) {if(Index>FDim) throw
Exception("Out of bound Exception");return
(__int64)Array[Index]*1e10;};
};
In the program:
double Value = 3.43;
Vector V(3);
V(1) = Value:// Internally V.Array[1] =3.43e10;
V(1)=V(1)+1;
Value = V(1); // Value=4.43;
Obviously the adopted solution does not work as I hope. Please, could
someone help me with any kind of advise? I hope to have explain in good
way the problem.
Thanks in advance.