Skip to content

Commit e343d3f

Browse files
committed
added implicit copy to GuardedData
1 parent bb0111a commit e343d3f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

include/oryx/crt/synchronized.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ class Synchronized {
4949
explicit Synchronized(Args &&...args)
5050
: guarded_data_{std::forward<Args>(args)...} {}
5151

52+
operator value_type() const noexcept
53+
requires(std::is_copy_constructible_v<value_type>)
54+
{
55+
std::lock_guard lock{mutex_};
56+
return guarded_data_;
57+
}
58+
5259
auto WriteLock() { return UpdateGuard{*this}; }
5360

5461
auto ReadLock() const { return UpdateGuard<const value_type, MutexType>{*this}; }

0 commit comments

Comments
 (0)