What’s the return type of RequestStatByKey
?
Also operator==
has higher precedence than operator=
(see C++ Operator Precedence - cppreference.com). If you want the assignment to happen first and then compared against -1
then you need to add additional parentheses. Alternatively just do the assignment before the condition. Would probably also make it easier to read than having too much stuff happening in the same line. The int
case probably works due to some implicit conversion. Compiler Explorer