/////////////////////////////////////////////////////////////////////////////// // Reference implementation of std::generator proposal P2168. // // See https://wg21.link/P2168 for details. // /////////////////////////////////////////////////////////////////////////////// // Copyright Lewis Baker, Corentin Jabot // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. // (See accompanying file LICENSE or http://www.boost.org/LICENSE_1_0.txt) /////////////////////////////////////////////////////////////////////////////// module; #include #include export module nihil.generator:coroutine_traits; import :byte_allocator; import :forward; import :generator_promise; namespace std { // Type-erased allocator with default allocator behaviour. export template struct coroutine_traits, Args...> { using promise_type = nihil::generator_promise, std::allocator>; }; // Type-erased allocator with std::allocator_arg parameter export template struct coroutine_traits, allocator_arg_t, Alloc, Args...> { private: using byte_allocator = nihil::byte_allocator_t; public: using promise_type = nihil::generator_promise, byte_allocator, true /*explicit Allocator*/>; }; // Type-erased allocator with std::allocator_arg parameter (non-static member functions) export template struct coroutine_traits, This, allocator_arg_t, Alloc, Args...> { private: using byte_allocator = nihil::byte_allocator_t; public: using promise_type = nihil::generator_promise, byte_allocator, true /*explicit Allocator*/>; }; // Generator with specified allocator type export template struct coroutine_traits, Args...> { using byte_allocator = nihil::byte_allocator_t; public: using promise_type = nihil::generator_promise, byte_allocator>; }; } // namespace std