Alias std::launder when it is available
authorYedidya Feldblum <yfeldblum@fb.com>
Fri, 3 Nov 2017 02:44:08 +0000 (19:44 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 3 Nov 2017 03:00:05 +0000 (20:00 -0700)
Summary: [Folly] Alias `std::launder` when it is available.

Reviewed By: Orvid

Differential Revision: D6221443

fbshipit-source-id: 33136a8744a39db01fb05513d5ed5476ea67559a

folly/lang/Launder.h

index fb0e5f7..b54d7e6 100644 (file)
 
 #pragma once
 
+#include <new>
+
 #include <folly/CPortability.h>
 #include <folly/Portability.h>
 
+/***
+ *  include or backport:
+ *  * std::launder
+ */
+
+#if __cpp_lib_launder >= 201606
+
+namespace folly {
+
+/* using override */ using std::launder;
+
+} // namespace folly
+
+#else
+
 namespace folly {
 
 /**
@@ -54,3 +71,5 @@ void launder(void const volatile*) = delete;
 template <typename T, typename... Args>
 void launder(T (*)(Args...)) = delete;
 } // namespace folly
+
+#endif