MassManager: return empty_string by ref instead of a temp object.

This commit is contained in:
Guillaume Jacquemin 2020-10-02 12:55:31 +02:00
parent 4e1a74e03e
commit 685bc59540
2 changed files with 3 additions and 3 deletions

View file

@ -241,7 +241,7 @@ auto MassManager::stagedMasses() -> std::map<std::string, std::string> const& {
return _stagedMasses;
}
auto MassManager::stagedMassName(int index) -> std::string {
auto MassManager::stagedMassName(int index) -> std::string const& {
int i = 0;
for(const auto& mass_info : _stagedMasses) {
if(i != index) {
@ -252,7 +252,7 @@ auto MassManager::stagedMassName(int index) -> std::string {
return mass_info.second;
}
return std::string{""};
return empty_string;
}
auto MassManager::updateStagedMass(const std::string& filename) -> int {

View file

@ -49,7 +49,7 @@ class MassManager {
auto stagedMasses() -> std::map<std::string, std::string> const&;
auto stagedMassName(int index) -> std::string;
auto stagedMassName(int index) -> std::string const&;
auto updateStagedMass(const std::string& filename) -> int;
auto removeStagedMass(const std::string& filename) -> int;