Commit 9d601541 authored by Stepan Palamarchuk's avatar Stepan Palamarchuk Committed by Facebook GitHub Bot

Add an rvalue overload of Snapshot<T>::getShared()

Summary:
This allows to avoid unnecessary copy of `shared_ptr`.

(Note: this ignores all push blocking failures!)

Reviewed By: andriigrynenko

Differential Revision: D20596972

fbshipit-source-id: 6411ee2f735c1db1984bcd83ceddf80e4ec6f22b
parent 55fc4b32
......@@ -92,10 +92,14 @@ class Snapshot {
return data_.get();
}
std::shared_ptr<const T> getShared() const {
std::shared_ptr<const T> getShared() const& {
return data_;
}
std::shared_ptr<const T> getShared() && {
return std::move(data_);
}
/**
* Return the version of the observed object.
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment