Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use emplace_back instead of push_back #1826

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/syzygy/tbprobe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ void Tablebases::init(const std::string& paths) {
continue; // First on diagonal, second above

else if (!off_A1H8(s1) && !off_A1H8(s2))
bothOnDiagonal.push_back(std::make_pair(idx, s2));
bothOnDiagonal.emplace_back(idx, s2);

else
MapKK[idx][s2] = code++;
Expand Down
4 changes: 2 additions & 2 deletions src/tt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void TranspositionTable::clear() {

for (size_t idx = 0; idx < Options["Threads"]; idx++)
{
threads.push_back(std::thread([this, idx]() {
threads.emplace_back([this, idx]() {

// Thread binding gives faster search on systems with a first-touch policy
if (Options["Threads"] > 8)
Expand All @@ -97,7 +97,7 @@ void TranspositionTable::clear() {
stride : clusterCount - start;

std::memset(&table[start], 0, len * sizeof(Cluster));
}));
});
}

for (std::thread& th: threads)
Expand Down