Pass input of UtilityClass::GCString() by const reference

This avoids an unnecessary copy of the input std::vector, since we don't
need to modify it for anything. This cuts down on unnecessary memory
operations.
This commit is contained in:
Misa authored and Ethan Lee committed 2021-02-07 18:30:13 -05:00
1 parent 46b0257cf1
commit 06cc5afe27
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -119,7 +119,7 @@ int UtilityClass::Int(const char* str, int fallback /*= 0*/)
return (int) SDL_strtol(str, NULL, 0);
}
std::string UtilityClass::GCString(std::vector<SDL_GameControllerButton> buttons)
std::string UtilityClass::GCString(const std::vector<SDL_GameControllerButton>& buttons)
{
std::string retval = "";
for (size_t i = 0; i < buttons.size(); i += 1)
+1 -1
View File
@@ -39,7 +39,7 @@ public:
static int Int(const char* str, int fallback = 0);
static std::string GCString(std::vector<SDL_GameControllerButton> buttons);
static std::string GCString(const std::vector<SDL_GameControllerButton>& buttons);
std::string twodigits(int t);