cute_to_string operator overloading fails

Added by matt resiter about 4 years ago

I am trying to compile a simple cute program and i have reciveing the following error on the select+build_in_shift_if function:

operator '<<' cannot be resolved for type '1 6 108 14 cute::cute_to_string::select_built_in_shift_if 2 #0 10 103 225 10 3 #1 0 cute::cute_to_string::select_built_in_shift_if::os 35 cute::cute_to_string::select_built_in_shift_if::operator () 0 0'.

The code that generates this is:

template &lt;typename T, bool select&gt;
struct select_built_in_shift_if {
std::ostream &os;
select_built_in_shift_if(std::ostream &ros):os(ros){}
std::ostream& operator()(T const &t){
return os << t ; // default uses operator<<(std::ostream&,T const&) if available
}
};

the line "return os << t " seems to be the problem.

I tried to reason through this myself ( am still somewhat new to c++ so i did the best i can), but i didn't have much luck

I am assuming the operator "<<" is not properly overloaded for the types "ostream" and "T const &t", but i dont where this overloading would be defined in the code if it is at all.

If anyone has any input i would appreciate it.

Thanks


Replies (2)

RE: cute_to_string operator overloading fails - Added by Thomas Corbat about 4 years ago

Hi Matt

Hm... the error you posted does not look like a compile error. That looks rather like an error in our Codan checkers (Static code analysis). Could you post your unit test code which does not work here?

Regards
Thomas

RE: cute_to_string operator overloading fails - Added by matt resiter about 4 years ago

Ah you are right....

Sorry i am a little new to eclipse and c++... thanks

(1-2/2)