projects
/
folly.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
An intro to the upgrade mutex in the Synchronized docs
[folly.git]
/
folly
/
Optional.h
diff --git
a/folly/Optional.h
b/folly/Optional.h
index 6fc07b98f47e204f2f5501cca717087b7c5608a1..2b12ccc6a310d5a708cf945403bc0d91a2245c01 100644
(file)
--- a/
folly/Optional.h
+++ b/
folly/Optional.h
@@
-54,6
+54,7
@@
* }
*/
#include <cstddef>
* }
*/
#include <cstddef>
+#include <new>
#include <stdexcept>
#include <type_traits>
#include <utility>
#include <stdexcept>
#include <type_traits>
#include <utility>
@@
-205,6
+206,9
@@
class Optional {
return storage_.value;
}
return storage_.value;
}
+ // TODO: This should return Value&& instead of Value. Like with
+ // std::move, the calling code should decide whether it wants the move
+ // to happen or not. See std::optional.
Value value() && {
require_value();
return std::move(storage_.value);
Value value() && {
require_value();
return std::move(storage_.value);
@@
-226,6
+230,9
@@
class Optional {
const Value& operator*() const& { return value(); }
Value& operator*() & { return value(); }
const Value& operator*() const& { return value(); }
Value& operator*() & { return value(); }
+ // TODO: This should return Value&& instead of Value. Like with
+ // std::move, the calling code should decide whether it wants the move
+ // to happen or not. See std::optional.
Value operator*() && { return std::move(value()); }
const Value* operator->() const { return &value(); }
Value operator*() && { return std::move(value()); }
const Value* operator->() const { return &value(); }