Here is the code.
std::map<int, double> function_xx() {
std::map<int, double> xx_map;
.... //some code
return xx_map;
}
std::map<int, double> function_yy() {
std::map<int, double> yy_map;
.... //some code
return yy_map;
}
void function_abc() {
std::map<int, double> abc_map;
// some code
if (match_situation_xx) {
abc_map = std::move(function_xx());
} else if (match_situation_yy) {
abc_map = std::move(function_yy());
}
// other code
}
I think it does not make sense, because std::map
has implemented map& operator=( map&& other );
and the return value is a right value.
Have I got it right, please?