1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00

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 2021-02-07 13:17:22 -08:00 committed by Ethan Lee
parent 46b0257cf1
commit 06cc5afe27
2 changed files with 2 additions and 2 deletions

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)

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);