Add steal to lockable

This commit is contained in:
Joshua Ashton 2020-08-08 01:24:46 +01:00
parent 81e71dd452
commit a5a79e2d38
1 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,9 @@ namespace Feather
auto borrow() { return std::pair< T&, std::lock_guard<std::mutex>>{object, mutex}; }
auto borrow() const { return std::pair<const T&, std::lock_guard<std::mutex>>{object, mutex}; }
T& steal() { return object; }
const T& steal() const { return object; }
private:
T object;
mutable std::mutex mutex;