From: Phil Willoughby Date: Thu, 6 Jul 2017 07:09:18 +0000 (-0700) Subject: launder X-Git-Tag: v2017.07.10.00~6 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=1eee8628ee22c2382f7617e13eb5039bff7c9258 launder Summary: Backport C++17's `std::launder`. Reviewed By: yfeldblum, ot Differential Revision: D5370531 fbshipit-source-id: b7cc6701d082b6c4855fa77bb644e151ce882deb --- diff --git a/folly/Utility.h b/folly/Utility.h index d84abb7b..dbe552f0 100644 --- a/folly/Utility.h +++ b/folly/Utility.h @@ -260,4 +260,11 @@ class MoveOnly { using MoveOnly = moveonly_::MoveOnly; +/** + * Backport from C++17 of std::launder + */ +template +constexpr T* launder(T* in) { + return (in + 1) - 1; +} } // namespace folly