The error I am receiving is that "palindrome.cpp:14: error: no match for âoperator==â in âreversechar(((std::string&)(& line)), 0u, (line.std::basic_string<_CharT, _Traits, _Alloc>::length [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]() - 1ul)) == lineâ" I don't know what this is and how to fix it.
You are wrong.Your function works incorrectly. You are not comparing the original string with the reversed string. You always compare the reversed string with itself.:) It is because you pass the original string by reference to the function.
Yea thanks, I tested it out and it doesn't work. I removed the function and changed the if condition to line == string( line.rbegin(), line.rend() ) and now it's working.