Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: webrtc/base/optional.h

Issue 2681283002: Add ability to return moved value from FunctorMessageHandler, Optional. (Closed)
Patch Set: Rename to MoveValue as suggested. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/messagehandler.h ('k') | webrtc/base/optional_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/optional.h
diff --git a/webrtc/base/optional.h b/webrtc/base/optional.h
index 4d2b44e0cb62ed4d3f6cbf91c8f2649ba73c7a28..f5354ee0f25fdb6eabcf6fa367e3db64152681ee 100644
--- a/webrtc/base/optional.h
+++ b/webrtc/base/optional.h
@@ -239,6 +239,12 @@ class Optional final {
: default_val;
}
+ // Dereference and move value.
+ T MoveValue() {
+ RTC_DCHECK(has_value_);
+ return std::move(value_);
+ }
+
// Equality tests. Two Optionals are equal if they contain equivalent values,
// or if they're both empty.
friend bool operator==(const Optional& m1, const Optional& m2) {
« no previous file with comments | « webrtc/base/messagehandler.h ('k') | webrtc/base/optional_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698