From c7ef5c6f645d612335f72f01d5c90642bbe74780 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Mon, 10 Dec 2018 06:07:43 +0100 Subject: [PATCH] Adhust the SFO buffer size so it can contain a pointer at zero cost --- include/continuable/continuable-trait.hpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/continuable/continuable-trait.hpp b/include/continuable/continuable-trait.hpp index 4e69507..318f694 100644 --- a/include/continuable/continuable-trait.hpp +++ b/include/continuable/continuable-trait.hpp @@ -70,11 +70,17 @@ public: /// The continuable type for the given parameters. using continuable = continuable_base< - ContinuationWrapper), - void(promise), // - bool(is_ready_arg_t) const, // - std::tuple(query_arg_t) // - >, + ContinuationWrapper< + // Size the buffer for the small functor optimization so the + // result itself fits in and guarantee that a pointer can + // fit in as well. + (sizeof(detail::base::ready_continuation) < sizeof(void*) + ? sizeof(void*) + : sizeof(detail::base::ready_continuation)), + void(promise), // + bool(is_ready_arg_t) const, // + std::tuple(query_arg_t) // + >, detail::traits::identity>; }; /// \}