MultiVersion: add ctor, set from unique_ptr

This commit is contained in:
Pavel Kartavyy 2016-06-09 15:50:26 +03:00
parent 49318b6cc5
commit 2435af6e31

View File

@ -47,6 +47,11 @@ public:
set(std::move(value));
}
MultiVersion(std::unique_ptr<T> && value)
{
set(std::move(value));
}
/// Получить текущую версию для использования. Возвращает shared_ptr, который определяет время жизни версии.
const Version get() const
{
@ -68,6 +73,11 @@ public:
set(Version(value));
}
void set(std::unique_ptr<T> && value)
{
set(Version(value.release()));
}
private:
Version current_version;
mutable std::mutex mutex;