mirror of
https://github.com/NixOS/nix
synced 2025-06-28 17:51:15 +02:00
std::visit
by reference
I had started the trend of doing `std::visit` by value (because a type error once mislead me into thinking that was the only form that existed). While the optomizer in principle should be able to deal with extra coppying or extra indirection once the lambdas inlined, sticking with by reference is the conventional default. I hope this might even improve performance.
This commit is contained in:
parent
6a8d6246f6
commit
242f9bf3dc
19 changed files with 88 additions and 88 deletions
|
@ -24,8 +24,8 @@ StorePathSet BuiltPath::outPaths() const
|
|||
{
|
||||
return std::visit(
|
||||
overloaded{
|
||||
[](BuiltPath::Opaque p) { return StorePathSet{p.path}; },
|
||||
[](BuiltPath::Built b) {
|
||||
[](const BuiltPath::Opaque & p) { return StorePathSet{p.path}; },
|
||||
[](const BuiltPath::Built & b) {
|
||||
StorePathSet res;
|
||||
for (auto & [_, path] : b.outputs)
|
||||
res.insert(path);
|
||||
|
@ -94,8 +94,8 @@ RealisedPath::Set BuiltPath::toRealisedPaths(Store & store) const
|
|||
RealisedPath::Set res;
|
||||
std::visit(
|
||||
overloaded{
|
||||
[&](BuiltPath::Opaque p) { res.insert(p.path); },
|
||||
[&](BuiltPath::Built p) {
|
||||
[&](const BuiltPath::Opaque & p) { res.insert(p.path); },
|
||||
[&](const BuiltPath::Built & p) {
|
||||
auto drvHashes =
|
||||
staticOutputHashes(store, store.readDerivation(p.drvPath));
|
||||
for (auto& [outputName, outputPath] : p.outputs) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue