Better readability and optimization insertion into container by replacing 'insert' -> 'emplace', 'push_back' -> 'emplace_back'

This commit is contained in:
lainon committed 2022-09-30 12:35:28 +03:00
1 parent c953bf7fc7
commit 3cdf72b68b
20 files changed
+49 -49

No files matched your search

+3 -3
View File
@@ -219,9 +219,9 @@ bool SetRestrictPrims(const char *rule) {
// If there's nothing yet, add everything else.
if (updated.empty()) {
if (range.first > 0)
updated.push_back(std::make_pair(0, range.first - 1));
updated.emplace_back(0, range.first - 1);
if (range.second < MAX_PRIMS)
updated.push_back(std::make_pair(range.second + 1, MAX_PRIMS));
updated.emplace_back(range.second + 1, MAX_PRIMS);
continue;
}
@@ -240,7 +240,7 @@ bool SetRestrictPrims(const char *rule) {
// We're slicing a hole in this subrange.
int next = sub.second;
sub.second = range.first - 1;
updated.push_back(std::make_pair(range.second + 1, next));
updated.emplace_back(range.second + 1, next);
continue;
}