We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 977e732 commit e6a33aaCopy full SHA for e6a33aa
src/libprojectM/PresetLoader.cpp
@@ -159,12 +159,7 @@ const std::vector<std::string> &PresetLoader::getPresetNames() const
159
// Get the preset index given a name
160
const unsigned int PresetLoader::getPresetIndex(std::string &name) const
161
{
162
- //Need a better structure than a vector for reverse lookup
163
- for (int index = 0; index < _presetNames.size(); index++)
164
- {
165
- if (_presetNames[index] == name) return index;
166
- }
167
- return 0;
+ return find(_presetNames.begin(), _presetNames.end(), name) - _presetNames.begin();
168
}
169
170
int PresetLoader::getPresetRating ( PresetIndex index, const PresetRatingType ratingType ) const
0 commit comments