16 #ifndef BLOOMBERG_QUANTUM_CAPTURE_H 17 #define BLOOMBERG_QUANTUM_CAPTURE_H 19 #include <quantum/impl/quantum_stl_impl.h> 20 #include <quantum/quantum_traits.h> 21 #include <quantum/quantum_allocator_traits.h> 22 #include <type_traits> 37 template <
typename FUNC,
typename ... ARGS>
41 Capture(FUNC&& func, ARGS&&...args);
43 template <
typename ... T>
47 std::tuple<ARGS...> _args;
51 template <
typename FUNC,
typename ... ARGS>
61 template <
typename RET,
typename ... ARGS>
64 template <
typename RET,
typename ... ARGS>
67 static constexpr
size_t size{__QUANTUM_FUNCTION_ALLOC_SIZE};
68 using Func = RET(*)(ARGS...);
69 using Callback = RET(*)(
void*, ARGS...);
70 using Deleter = void(*)(
void*);
75 template <
typename FUNCTOR>
84 RET operator()(ARGS...args);
85 explicit operator bool()
const;
88 static void dummyDeleter(
void*) {}
89 static void deleter(
void* p) {
delete[] static_cast<char*>(p); }
91 template <
typename FUNCTOR>
92 void initFunctor(FUNCTOR&& functor, std::true_type);
94 template <
typename FUNCTOR>
95 void initFunctor(FUNCTOR&& functor, std::false_type);
97 std::array<char, size> _storage;
105 #include <quantum/impl/quantum_capture_impl.h> 107 #endif //BLOOMBERG_QUANTUM_CAPTURE_H Definition: quantum_buffer_impl.h:22
Capture(FUNC &&func, ARGS &&...args)
Definition: quantum_capture_impl.h:29
int operator()(T &&...t)
Definition: quantum_capture_impl.h:36
Similar implementation to std::function except that it allows capture of non-copyable types.
Definition: quantum_capture.h:62
Capture< FUNC, ARGS... > makeCapture(FUNC &&func, ARGS &&... args)
Definition: quantum_capture_impl.h:42
Class allowing lambda parameter captures.
Definition: quantum_capture.h:38