Scenario: define a structure a, and then STD:: Map < A, B> m;
Error: error c2678: binary ‘<‘, no left operand operator (or no acceptable conversion) that accepts type ‘const a’ was found
Reason: overloaded “<“, const is not added after the parameter list
Solution: add const after the parameter list
bool operator < (const A& v) const { ... }
Note: if “<” is not overloaded, many errors will be reported. C2784 can not deduce the parameter template error
Similar Posts:
- [Solved] Operator overload must take either zero or one argument error
- C++ error: cannot bind non-const lvalue reference of type ‘myString&’ to an rvalue of type ‘m…
- error: no match for ‘operator<' (operand types are 'const Request_Info' and 'const Request_Info')xxxxxxx
- Solution to the problem of “TypeError: Assignment to constant variable”
- How to Solve Const variable assignment Error
- [Solved] sphelper.h Compile Error: error C4430/C2065/C2440/C2664
- [Solved] FATAL ERROR: wasm code commit Allocation failed – process out of memory
- [Solved] Undefined reference_G++ _GLIBCXX_USE_CXX11_ ABI compilation error: STD:: Basic_String and STD::__cxx11::basic_String cannot match
- [Solved] expected specifier-qualifier-list before sth
- [Solved] undefined reference to `cv::imread(std::string const&, int)’