Determine noexcept'ness of folly::Optional with std::is_nothrow_constructible
authorChristopher Dykes <cdykes@fb.com>
Fri, 7 Jul 2017 09:59:14 +0000 (02:59 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 7 Jul 2017 10:05:21 +0000 (03:05 -0700)
Summary: Because MSVC is not happy about how it's written now.

Reviewed By: yfeldblum

Differential Revision: D5378740

fbshipit-source-id: 8b77d1a05da75b331e0cb72bd0ad859b89e54b36

folly/Optional.h

index c6980c186632a1f3183f9f5db93cb5e2b1ecc452..ce8bcf1aa6346c7fcd4c69e6236c8d2192f565d3 100644 (file)
@@ -128,8 +128,8 @@ class Optional {
   }
 
   template <typename... Args>
-  explicit Optional(in_place_t, Args&&... args)
-    noexcept(noexcept(::new (nullptr) Value(std::declval<Args&&>()...))) {
+  explicit Optional(in_place_t, Args&&... args) noexcept(
+      std::is_nothrow_constructible<Value, Args...>::value) {
     construct(std::forward<Args>(args)...);
   }