C++ less operator -
I am getting this error:
Error 1 error C2678: binary '& lt ; ': No operator found which takes a left hand operation type' const data '(or no acceptable conversion)
but my struct is defined like this:
< Pre> structure data {string strudata; Int intData; Double DoubleData; Data (): InteData (-1), DoubleData (-0.F) {} Data (Const String and String, Int I., Double D): Stradata (ARR), InteData (I), DoubleData (D) The Bull Operator & lt; (Constant & amp; Rewardata) {Return strData & lt; RightData.strData; }};
I think I have '& lt;' Operator, though the compiler tells that I do not
mention one thing, now I am comparing the const data ;
data type, maybe
const
does something bad
I think that this is just a small mistake, but I can not see it ...
You should:
Bull Operator & lt; (Constant & amp; rightData) Const {return strData & lt; RightData.strData; }
and string
class also requires an operator, if it is not.
Comments
Post a Comment