diff --git a/folly/Optional.h b/folly/Optional.h index a6fc7ebc3b9..8ae28d8b9f5 100644 --- a/folly/Optional.h +++ b/folly/Optional.h @@ -62,13 +62,10 @@ #include #include #include +#include #include #include #include -#if __cplusplus >= 201703L && __has_include() -#define FOLLY_HAS_STD_OPTIONAL -#include -#endif #include #include @@ -182,8 +179,8 @@ class Optional { p.promise_->value_ = this; } -// Conversions to ease migration to std::optional -#ifdef FOLLY_HAS_STD_OPTIONAL + // Conversions to ease migration to std::optional + /// Allow construction of Optional from std::optional. template < typename U, @@ -219,7 +216,6 @@ class Optional { return storage_.hasValue ? std::optional(storage_.value) : std::nullopt; } -#endif /// Set the Optional /// @methodset Modifiers diff --git a/folly/test/OptionalTest.cpp b/folly/test/OptionalTest.cpp index bbfd38f712a..082d3845171 100644 --- a/folly/test/OptionalTest.cpp +++ b/folly/test/OptionalTest.cpp @@ -836,7 +836,6 @@ TEST(Optional, NoneMatchesNullopt) { EXPECT_FALSE(op.has_value()); } -#if __cplusplus >= 201703L && __has_include() TEST(Optional, StdOptionalConversions) { folly::Optional f = 42; std::optional s = static_cast>(f); @@ -858,7 +857,6 @@ TEST(Optional, StdOptionalConversions) { EXPECT_EQ(**fp, 42); EXPECT_FALSE(sp); } -#endif TEST(Optional, MovedFromOptionalIsEmpty) { // moved-from folly::Optional is empty, unlike std::optional!