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>; }; /// \}