diff --git a/lix/libexpr/symbol-table.hh b/lix/libexpr/symbol-table.hh index 0b99fdadd..b50a52f50 100644 --- a/lix/libexpr/symbol-table.hh +++ b/lix/libexpr/symbol-table.hh @@ -90,7 +90,7 @@ public: auto it = symbols.find(s); if (it != symbols.end()) return Symbol(it->second.second + 1); - const auto & [rawSym, idx] = store.add(std::string(s)); + const auto & [rawSym, idx] = store.add(s); symbols.emplace(rawSym, std::make_pair(&rawSym, idx)); return Symbol(idx + 1); } diff --git a/lix/libutil/chunked-vector.hh b/lix/libutil/chunked-vector.hh index d914e2542..a14793768 100644 --- a/lix/libutil/chunked-vector.hh +++ b/lix/libutil/chunked-vector.hh @@ -45,7 +45,8 @@ public: uint32_t size() const { return size_; } - std::pair add(T value) + template + std::pair add(Args &&... args) { const auto idx = size_++; auto & chunk = [&] () -> auto & { @@ -53,7 +54,7 @@ public: return back; return addChunk(); }(); - auto & result = chunk.emplace_back(std::move(value)); + auto & result = chunk.emplace_back(std::forward(args)...); return {result, idx}; }