From ba9ab0c85590ae4b114d56268b529ca481a1de89 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Tue, 11 Mar 2025 15:00:59 +0100 Subject: [PATCH] libutil: add in-place construction to Sync only then can we Sync<> non-movable types. Change-Id: I7835cdaf9fd2b90c842c9e054942524f36515d5a --- lix/libutil/sync.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lix/libutil/sync.hh b/lix/libutil/sync.hh index 7b051801f..edce1820c 100644 --- a/lix/libutil/sync.hh +++ b/lix/libutil/sync.hh @@ -10,6 +10,7 @@ #include #include #include +#include namespace nix { @@ -44,6 +45,9 @@ public: Sync(const T & data) : data(data) { } Sync(T && data) noexcept : data(std::move(data)) { } + template + Sync(std::in_place_t, Args &&... args) : data(std::forward(args)...) { } + class Lock { protected: