diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-09-30 21:31:21 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-09-30 21:35:09 +0000 |
commit | 242f9bf3dc04170502020fb0338b78ea76b9ebac (patch) | |
tree | d1d1e310e28b1b4b118aa81deee9a8e82b7abf0b /src/libcmd/command.cc | |
parent | 6a8d6246f603a372d557ab026670ae42bad558b0 (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/libcmd/command.cc')
-rw-r--r-- | src/libcmd/command.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 0d61e12d0..fd3edfc46 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -203,10 +203,10 @@ void MixProfile::updateProfile(const BuiltPaths & buildables) for (auto & buildable : buildables) { std::visit(overloaded { - [&](BuiltPath::Opaque bo) { + [&](const BuiltPath::Opaque & bo) { result.push_back(bo.path); }, - [&](BuiltPath::Built bfd) { + [&](const BuiltPath::Built & bfd) { for (auto & output : bfd.outputs) { result.push_back(output.second); } |