diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-05-22 16:09:13 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-05-22 16:09:13 +0100 |
commit | 3fc1dd846c4e5b72b6141a89f08790c85f84df31 (patch) | |
tree | 749c75f56d4a0a5192da96238d153bf3a021450c | |
parent | Handle batch reads as they come back (diff) | |
download | netfs-1.5.0.tar.bz2 netfs-1.5.0.tar.xz netfs-1.5.0.zip |
Replace transform_reduce with a lambda and transformnetfs-1.5.0
I just hate the amount of object code transform_reduce produces
-rw-r--r-- | netfs/fuse/fuseFiles.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp index 82df245..29a0096 100644 --- a/netfs/fuse/fuseFiles.cpp +++ b/netfs/fuse/fuseFiles.cpp @@ -138,15 +138,14 @@ namespace NetFS { return f(key); } else { - const auto overlap = std::transform_reduce( - R.first, R.second, std::vector<std::shared_future<void>> {}, - [](auto && v, auto && i) { - v.push_back(i); - return std::forward<decltype(v)>(v); - }, - [](auto && i) { - return i.second->future; - }); + const auto overlap = [R]() { + std::vector<std::shared_future<void>> out; + out.reserve(safe<ptrdiff_t> {std::distance(R.first, R.second)}); + std::transform(R.first, R.second, std::back_inserter(out), [](auto && i) { + return i.second->future; + }); + return out; + }(); // Wait for them whilst unlocked lock.release()->unlock(); try { |