Commit 8a82e909 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

thunk::fail

Reviewed By: iahs

Differential Revision: D27036059

fbshipit-source-id: 15166a6e7ec58d873a1d6799a3b1eb1ad64de420
parent cc95898a
......@@ -16,6 +16,8 @@
#pragma once
#include <exception>
namespace folly {
namespace detail {
......@@ -27,6 +29,7 @@ namespace detail {
// * ctor: in-place constructor with given arguments
// * dtor: in-place destructor
// * noop: no-op function with the given arguments
// * fail: terminating function with the given return and arguments
struct thunk {
template <typename T, typename... A>
static void* make(A... a) {
......@@ -46,8 +49,13 @@ struct thunk {
static_cast<T*>(ptr)->~T();
}
template <typename... T>
static void noop(T...) noexcept {}
template <typename... A>
static void noop(A...) noexcept {}
template <typename R, typename... A>
static R fail(A...) noexcept {
std::terminate();
}
};
} // namespace detail
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment