O
Oliver Michael Milz
Hi *,
I have a class called r_Point with two operators defined as follows:
r_Range
r_Point:perator[]( r_Dimension i ) const throw( r_Eindex_violation )
{
return points;
}
r_Range&
r_Point:perator[]( r_Dimension i ) throw( r_Eindex_violation )
{
return points;
}
!!! This is not my hack, I just have to use it. !!!
Can anyone please tell me what the hell the meaning of this is ?
Under what circumstances is the first []operator called and under what
the second ?
There is twice the same implementation, differing only by the keyword
const and the return type. In my eyes that should never compile.
Actually it does...
When I wanna use it:
r_Point r_point =...;
for(r_Dimension r=0; r<dimensioality; r++)
{
r_Range r_range = r_point[r];
....
}
the compiler won´t compile, cause it´s saying that r_point[r] is of type
r_Point and not of r_Range.
Like the operator [] would not have been overridden ...
My fix was to create a method called getRange, whose implementation
equals
the one of the operators. That works. But is not really beautiful.
Please help,
Thanks,
Oliver Milz
I have a class called r_Point with two operators defined as follows:
r_Range
r_Point:perator[]( r_Dimension i ) const throw( r_Eindex_violation )
{
return points;
}
r_Range&
r_Point:perator[]( r_Dimension i ) throw( r_Eindex_violation )
{
return points;
}
!!! This is not my hack, I just have to use it. !!!
Can anyone please tell me what the hell the meaning of this is ?
Under what circumstances is the first []operator called and under what
the second ?
There is twice the same implementation, differing only by the keyword
const and the return type. In my eyes that should never compile.
Actually it does...
When I wanna use it:
r_Point r_point =...;
for(r_Dimension r=0; r<dimensioality; r++)
{
r_Range r_range = r_point[r];
....
}
the compiler won´t compile, cause it´s saying that r_point[r] is of type
r_Point and not of r_Range.
Like the operator [] would not have been overridden ...
My fix was to create a method called getRange, whose implementation
equals
the one of the operators. That works. But is not really beautiful.
Please help,
Thanks,
Oliver Milz