This change replaces the use of std::unique_ptr with std::optional for conditionally constructing a ReadLock object. The read lock object was recently introduced in PR #12624. This change makes the code more concise and clarifies that the lock is not meant to be transferred (as std::unique_ptr is movable). It also avoids a heap allocation.
This change replaces the use of
std::unique_ptr
withstd::optional
for conditionally constructing aReadLock
object. The read lock object was recently introduced in PR #12624. This change makes the code more concise and clarifies that the lock is not meant to be transferred (asstd::unique_ptr
is movable). It also avoids a heap allocation.There are no functional changes.