libutil: add in-place construction to Sync
only then can we Sync<> non-movable types. Change-Id: I7835cdaf9fd2b90c842c9e054942524f36515d5a
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user