projects
/
folly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
737be95
)
launder
author
Phil Willoughby
<philwill@fb.com>
Thu, 6 Jul 2017 07:09:18 +0000
(
00:09
-0700)
committer
Facebook Github Bot
<facebook-github-bot@users.noreply.github.com>
Thu, 6 Jul 2017 07:21:40 +0000
(
00:21
-0700)
Summary: Backport C++17's `std::launder`.
Reviewed By: yfeldblum, ot
Differential Revision:
D5370531
fbshipit-source-id:
b7cc6701d082b6c4855fa77bb644e151ce882deb
folly/Utility.h
patch
|
blob
|
history
diff --git
a/folly/Utility.h
b/folly/Utility.h
index d84abb7be70f6ff3de98ac6e0229802b3b084367..dbe552f02aac940b79c34b2708ae18e4c4201d75 100644
(file)
--- 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 <typename T>
+constexpr T* launder(T* in) {
+ return (in + 1) - 1;
+}
} // namespace folly