aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/derived-path.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-09-30 21:31:21 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-09-30 21:35:09 +0000
commit242f9bf3dc04170502020fb0338b78ea76b9ebac (patch)
treed1d1e310e28b1b4b118aa81deee9a8e82b7abf0b /src/libstore/derived-path.cc
parent6a8d6246f603a372d557ab026670ae42bad558b0 (diff)
`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.
Diffstat (limited to 'src/libstore/derived-path.cc')
-rw-r--r--src/libstore/derived-path.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstore/derived-path.cc b/src/libstore/derived-path.cc
index 8da81d0ac..e55af21e9 100644
--- a/src/libstore/derived-path.cc
+++ b/src/libstore/derived-path.cc
@@ -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) {