26 func_ = std::forward<F>(func);
30 template <
typename F,
typename G>
44 dataSize_ =
sizeof(
T);
45 dataType_ = &
typeid(
T);
47 dataDestructor_ = dataBufferDestructor<T>;
50 dataDestructor_ = dataHeapDestructor<T>;
51 data_ = allocateHeapBuffer(dataSize_);
53 dataCopyConstructor_ = dataCopyConstructor<T>;
55 new (
reinterpret_cast<T*
>(
data_))
T();
57 return *
reinterpret_cast<T*
>(
data_);
62 new (
reinterpret_cast<T*
>(
ptr))
T(*reinterpret_cast<const T*>(other));
67 reinterpret_cast<T*
>(
ptr)->~
T();
72 reinterpret_cast<T*
>(
ptr)->~
T();
void setFunctionFinally(F &&func, G &&finally)
std::aligned_storage< kUserBufferSize >::type userBuffer_
static void dataBufferDestructor(void *)
static void dataCopyConstructor(void *, const void *)
—— Concurrent Priority Queue Implementation ——
void setFunction(F &&func)
folly::Function< void()> resultFunc_
FOLLY_NOINLINE T & getSlow()
folly::Function< void()> func_
folly::Function< void()> finallyFunc_
static void dataHeapDestructor(void *)
std::unique_ptr< unsigned char[]> buffer_