Cleanup / optimizations

This commit is contained in:
2026-02-12 01:01:52 +00:00
parent e9d164d769
commit c683754d49
8 changed files with 141 additions and 78 deletions

View File

@@ -6,18 +6,19 @@
template <typename T> struct Queue {
void push(T val) {
std::lock_guard<std::mutex> lock(m);
q.push(val);
q.push(std::move(val));
}
std::optional<T> front() {
std::lock_guard<std::mutex> lock(m);
if (q.empty())
return std::nullopt;
return q.front();
return std::move(q.front());
}
bool pop(T &val) {
std::lock_guard<std::mutex> lock(m);
if (q.empty())
return false;
val = q.front();
val = std::move(q.front());
q.pop();
return true;
}