Commit 0207d08f authored by Chad Austin's avatar Chad Austin Committed by Facebook Github Bot

Remove default constructor for folly::None

Summary: It's never useful to write `folly::None()` or `folly::None{}` instead of using `folly::none`, so disallow the former. This brings `folly::none` closer to `std::nullopt`.

Reviewed By: yfeldblum

Differential Revision: D12842421

fbshipit-source-id: 7a3526c8ab16cda8eed1c60650d2cae939c9f96a
parent 08d12dac
...@@ -76,14 +76,15 @@ struct OptionalPromiseReturn; ...@@ -76,14 +76,15 @@ struct OptionalPromiseReturn;
} // namespace detail } // namespace detail
struct None { struct None {
enum class _secret { _token };
/** /**
* DEPRECATED: use folly::none * No default constructor to support both `op = {}` and `op = none`
* as syntax for clearing an Optional, just like std::nullopt_t.
*/ */
None() {} explicit constexpr None(_secret) {}
explicit constexpr None(int) {}
}; };
constexpr None none = None{0}; constexpr None none{None::_secret::_token};
class FOLLY_EXPORT OptionalEmptyException : public std::runtime_error { class FOLLY_EXPORT OptionalEmptyException : public std::runtime_error {
public: public:
......
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