libutil: add in-place construction to Sync

only then can we Sync<> non-movable types.

Change-Id: I7835cdaf9fd2b90c842c9e054942524f36515d5a
This commit is contained in:
eldritch horrors
2025-03-11 16:15:20 +00:00
parent be1491fa6a
commit ba9ab0c855
+4
View File
@@ -10,6 +10,7 @@
#include <condition_variable>
#include <cassert>
#include <optional>
#include <utility>
namespace nix {
@@ -44,6 +45,9 @@ public:
Sync(const T & data) : data(data) { }
Sync(T && data) noexcept : data(std::move(data)) { }
template<typename ... Args>
Sync(std::in_place_t, Args &&... args) : data(std::forward<Args>(args)...) { }
class Lock
{
protected: