No == operator found while comparing structs in C++

The Solution to No == operator found while comparing structs in C++ is


In C++, structs do not have a comparison operator generated by default. You need to write your own:

bool operator==(const MyStruct1& lhs, const MyStruct1& rhs)
{
    return /* your comparison code goes here */
}

~ Answered on 2011-04-21 06:25:17


Most Viewed Questions: