From 8f7f52eb800681c6c941cf31f3e39064fd81dd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Larsson?= Date: Tue, 18 May 2021 15:44:03 +0200 Subject: [PATCH] Remove ::experimental from coroutine namespace --- README.md | 28 +++++------ include/cppcoro/async_auto_reset_event.hpp | 4 +- include/cppcoro/async_generator.hpp | 50 +++++++++---------- include/cppcoro/async_manual_reset_event.hpp | 4 +- include/cppcoro/async_mutex.hpp | 4 +- include/cppcoro/async_scope.hpp | 8 +-- include/cppcoro/detail/is_awaiter.hpp | 6 +-- include/cppcoro/detail/sync_wait_task.hpp | 12 ++--- include/cppcoro/detail/when_all_counter.hpp | 4 +- .../detail/when_all_ready_awaitable.hpp | 14 +++--- include/cppcoro/detail/when_all_task.hpp | 10 ++-- .../detail/win32_overlapped_operation.hpp | 8 +-- include/cppcoro/file.hpp | 2 +- include/cppcoro/fmap.hpp | 2 +- include/cppcoro/generator.hpp | 22 ++++---- include/cppcoro/inline_scheduler.hpp | 2 +- include/cppcoro/io_service.hpp | 6 +-- include/cppcoro/multi_producer_sequencer.hpp | 8 +-- include/cppcoro/read_only_file.hpp | 2 +- include/cppcoro/read_write_file.hpp | 2 +- include/cppcoro/recursive_generator.hpp | 18 +++---- include/cppcoro/round_robin_scheduler.hpp | 14 +++--- include/cppcoro/sequence_barrier.hpp | 4 +- include/cppcoro/shared_task.hpp | 26 +++++----- ...single_consumer_async_auto_reset_event.hpp | 8 +-- include/cppcoro/single_consumer_event.hpp | 4 +- include/cppcoro/single_producer_sequencer.hpp | 4 +- include/cppcoro/static_thread_pool.hpp | 4 +- include/cppcoro/task.hpp | 34 ++++++------- include/cppcoro/write_only_file.hpp | 2 +- lib/async_auto_reset_event.cpp | 2 +- lib/async_manual_reset_event.cpp | 2 +- lib/async_mutex.cpp | 4 +- lib/file.cpp | 2 +- lib/io_service.cpp | 6 +-- lib/read_only_file.cpp | 2 +- lib/read_write_file.cpp | 2 +- lib/static_thread_pool.cpp | 4 +- lib/write_only_file.cpp | 2 +- test/file_tests.cpp | 6 +-- test/static_thread_pool_tests.cpp | 6 +-- 41 files changed, 177 insertions(+), 177 deletions(-) diff --git a/README.md b/README.md index 0dce93d5..b0effd3d 100644 --- a/README.md +++ b/README.md @@ -714,7 +714,7 @@ namespace cppcoro { public: bool await_ready() const noexcept; - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(std::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept; }; @@ -722,7 +722,7 @@ namespace cppcoro { public: bool await_ready() const noexcept; - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(std::coroutine_handle<> awaiter) noexcept; [[nodiscard]] async_mutex_lock await_resume() const noexcept; }; @@ -836,7 +836,7 @@ namespace cppcoro async_manual_reset_event_operation(async_manual_reset_event& event) noexcept; bool await_ready() const noexcept; - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(std::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept; }; } @@ -904,7 +904,7 @@ namespace cppcoro async_auto_reset_event_operation(const async_auto_reset_event_operation& other) noexcept; bool await_ready() const noexcept; - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(std::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept; }; @@ -1389,7 +1389,7 @@ namespace cppcoro schedule_operation(static_thread_pool* tp) noexcept; bool await_ready() noexcept; - bool await_suspend(std::experimental::coroutine_handle<> h) noexcept; + bool await_suspend(std::coroutine_handle<> h) noexcept; bool await_resume() noexcept; private: @@ -1546,7 +1546,7 @@ namespace cppcoro schedule_operation& operator=(const schedule_operation&) noexcept; bool await_ready() const noexcept; - void await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + void await_suspend(std::coroutine_handle<> awaiter) noexcept; void await_resume() noexcept; }; @@ -1560,7 +1560,7 @@ namespace cppcoro timed_schedule_operation& operator=(timed_schedule_operation&&) = delete; bool await_ready() const noexcept; - void await_suspend(std::experimental::coroutine_handle<> awaiter); + void await_suspend(std::coroutine_handle<> awaiter); void await_resume(); }; @@ -1596,7 +1596,7 @@ Example: #include #include -namespace fs = std::experimental::filesystem; +namespace fs = std::filesystem; cppcoro::task count_lines(cppcoro::io_service& ioService, fs::path path) { @@ -1740,7 +1740,7 @@ namespace cppcoro file_read_operation(file_read_operation&& other) noexcept; bool await_ready() const noexcept; - bool await_suspend(std::experimental::coroutine_handle<> awaiter); + bool await_suspend(std::coroutine_handle<> awaiter); std::size_t await_resume(); }; @@ -1752,7 +1752,7 @@ namespace cppcoro file_write_operation(file_write_operation&& other) noexcept; bool await_ready() const noexcept; - bool await_suspend(std::experimental::coroutine_handle<> awaiter); + bool await_suspend(std::coroutine_handle<> awaiter); std::size_t await_resume(); }; @@ -1774,7 +1774,7 @@ namespace cppcoro [[nodiscard]] static read_only_file open( io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_share_mode shareMode = file_share_mode::read, file_buffering_mode bufferingMode = file_buffering_mode::default_); @@ -1787,7 +1787,7 @@ namespace cppcoro [[nodiscard]] static write_only_file open( io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_open_mode openMode = file_open_mode::create_or_open, file_share_mode shareMode = file_share_mode::none, file_buffering_mode bufferingMode = file_buffering_mode::default_); @@ -1801,7 +1801,7 @@ namespace cppcoro [[nodiscard]] static read_write_file open( io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_open_mode openMode = file_open_mode::create_or_open, file_share_mode shareMode = file_share_mode::none, file_buffering_mode bufferingMode = file_buffering_mode::default_); @@ -2794,7 +2794,7 @@ coroutine. A type that satisfies `Awaiter` must have, for an instance of the type, `awaiter`: - `awaiter.await_ready()` -> `bool` -- `awaiter.await_suspend(std::experimental::coroutine_handle{})` -> `void` or `bool` or `std::experimental::coroutine_handle

` for some `P`. +- `awaiter.await_suspend(std::coroutine_handle{})` -> `void` or `bool` or `std::coroutine_handle

` for some `P`. - `awaiter.await_resume()` -> `T` Any type that implements the `Awaiter` concept also implements the `Awaitable` concept. diff --git a/include/cppcoro/async_auto_reset_event.hpp b/include/cppcoro/async_auto_reset_event.hpp index ce1f2d80..5820f803 100644 --- a/include/cppcoro/async_auto_reset_event.hpp +++ b/include/cppcoro/async_auto_reset_event.hpp @@ -80,7 +80,7 @@ namespace cppcoro async_auto_reset_event_operation(const async_auto_reset_event_operation& other) noexcept; bool await_ready() const noexcept { return m_event == nullptr; } - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(std::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept {} private: @@ -89,7 +89,7 @@ namespace cppcoro const async_auto_reset_event* m_event; async_auto_reset_event_operation* m_next; - std::experimental::coroutine_handle<> m_awaiter; + std::coroutine_handle<> m_awaiter; std::atomic m_refCount; }; diff --git a/include/cppcoro/async_generator.hpp b/include/cppcoro/async_generator.hpp index 4c2140da..8fa6f0b6 100644 --- a/include/cppcoro/async_generator.hpp +++ b/include/cppcoro/async_generator.hpp @@ -45,7 +45,7 @@ namespace cppcoro async_generator_promise_base(const async_generator_promise_base& other) = delete; async_generator_promise_base& operator=(const async_generator_promise_base& other) = delete; - std::experimental::suspend_always initial_suspend() const noexcept + std::suspend_always initial_suspend() const noexcept { return {}; } @@ -89,7 +89,7 @@ namespace cppcoro std::exception_ptr m_exception; - std::experimental::coroutine_handle<> m_consumerCoroutine; + std::coroutine_handle<> m_consumerCoroutine; protected: @@ -100,7 +100,7 @@ namespace cppcoro { public: - async_generator_yield_operation(std::experimental::coroutine_handle<> consumer) noexcept + async_generator_yield_operation(std::coroutine_handle<> consumer) noexcept : m_consumer(consumer) {} @@ -109,8 +109,8 @@ namespace cppcoro return false; } - std::experimental::coroutine_handle<> - await_suspend([[maybe_unused]] std::experimental::coroutine_handle<> producer) noexcept + std::coroutine_handle<> + await_suspend([[maybe_unused]] std::coroutine_handle<> producer) noexcept { return m_consumer; } @@ -119,7 +119,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle<> m_consumer; + std::coroutine_handle<> m_consumer; }; @@ -145,7 +145,7 @@ namespace cppcoro async_generator_advance_operation( async_generator_promise_base& promise, - std::experimental::coroutine_handle<> producerCoroutine) noexcept + std::coroutine_handle<> producerCoroutine) noexcept : m_promise(std::addressof(promise)) , m_producerCoroutine(producerCoroutine) { @@ -155,8 +155,8 @@ namespace cppcoro bool await_ready() const noexcept { return false; } - std::experimental::coroutine_handle<> - await_suspend(std::experimental::coroutine_handle<> consumerCoroutine) noexcept + std::coroutine_handle<> + await_suspend(std::coroutine_handle<> consumerCoroutine) noexcept { m_promise->m_consumerCoroutine = consumerCoroutine; return m_producerCoroutine; @@ -165,7 +165,7 @@ namespace cppcoro protected: async_generator_promise_base* m_promise; - std::experimental::coroutine_handle<> m_producerCoroutine; + std::coroutine_handle<> m_producerCoroutine; }; @@ -242,7 +242,7 @@ namespace cppcoro class async_generator_iterator final { using promise_type = async_generator_promise; - using handle_type = std::experimental::coroutine_handle; + using handle_type = std::coroutine_handle; public: @@ -307,7 +307,7 @@ namespace cppcoro class async_generator_begin_operation final : public async_generator_advance_operation { using promise_type = async_generator_promise; - using handle_type = std::experimental::coroutine_handle; + using handle_type = std::coroutine_handle; public: @@ -358,7 +358,7 @@ namespace cppcoro {} explicit async_generator(promise_type& promise) noexcept - : m_coroutine(std::experimental::coroutine_handle::from_promise(promise)) + : m_coroutine(std::coroutine_handle::from_promise(promise)) {} async_generator(async_generator&& other) noexcept @@ -408,7 +408,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle m_coroutine; + std::coroutine_handle m_coroutine; }; @@ -451,7 +451,7 @@ namespace cppcoro async_generator_promise_base(const async_generator_promise_base& other) = delete; async_generator_promise_base& operator=(const async_generator_promise_base& other) = delete; - std::experimental::suspend_always initial_suspend() const noexcept + std::suspend_always initial_suspend() const noexcept { return {}; } @@ -556,7 +556,7 @@ namespace cppcoro std::exception_ptr m_exception; - std::experimental::coroutine_handle<> m_consumerCoroutine; + std::coroutine_handle<> m_consumerCoroutine; protected: @@ -579,7 +579,7 @@ namespace cppcoro return m_initialState == state::value_not_ready_consumer_suspended; } - bool await_suspend(std::experimental::coroutine_handle<> producer) noexcept; + bool await_suspend(std::coroutine_handle<> producer) noexcept; void await_resume() noexcept {} @@ -625,7 +625,7 @@ namespace cppcoro } inline bool async_generator_yield_operation::await_suspend( - std::experimental::coroutine_handle<> producer) noexcept + std::coroutine_handle<> producer) noexcept { state currentState = m_initialState; if (currentState == state::value_not_ready_consumer_active) @@ -711,7 +711,7 @@ namespace cppcoro async_generator_advance_operation( async_generator_promise_base& promise, - std::experimental::coroutine_handle<> producerCoroutine) noexcept + std::coroutine_handle<> producerCoroutine) noexcept : m_promise(std::addressof(promise)) , m_producerCoroutine(producerCoroutine) { @@ -740,7 +740,7 @@ namespace cppcoro return m_initialState == state::value_ready_producer_suspended; } - bool await_suspend(std::experimental::coroutine_handle<> consumerCoroutine) noexcept + bool await_suspend(std::coroutine_handle<> consumerCoroutine) noexcept { m_promise->m_consumerCoroutine = consumerCoroutine; @@ -791,7 +791,7 @@ namespace cppcoro protected: async_generator_promise_base* m_promise; - std::experimental::coroutine_handle<> m_producerCoroutine; + std::coroutine_handle<> m_producerCoroutine; private: @@ -872,7 +872,7 @@ namespace cppcoro class async_generator_iterator final { using promise_type = async_generator_promise; - using handle_type = std::experimental::coroutine_handle; + using handle_type = std::coroutine_handle; public: @@ -937,7 +937,7 @@ namespace cppcoro class async_generator_begin_operation final : public async_generator_advance_operation { using promise_type = async_generator_promise; - using handle_type = std::experimental::coroutine_handle; + using handle_type = std::coroutine_handle; public: @@ -988,7 +988,7 @@ namespace cppcoro {} explicit async_generator(promise_type& promise) noexcept - : m_coroutine(std::experimental::coroutine_handle::from_promise(promise)) + : m_coroutine(std::coroutine_handle::from_promise(promise)) {} async_generator(async_generator&& other) noexcept @@ -1041,7 +1041,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle m_coroutine; + std::coroutine_handle m_coroutine; }; diff --git a/include/cppcoro/async_manual_reset_event.hpp b/include/cppcoro/async_manual_reset_event.hpp index 5f20688e..8014e234 100644 --- a/include/cppcoro/async_manual_reset_event.hpp +++ b/include/cppcoro/async_manual_reset_event.hpp @@ -87,7 +87,7 @@ namespace cppcoro explicit async_manual_reset_event_operation(const async_manual_reset_event& event) noexcept; bool await_ready() const noexcept; - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(std::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept {} private: @@ -96,7 +96,7 @@ namespace cppcoro const async_manual_reset_event& m_event; async_manual_reset_event_operation* m_next; - std::experimental::coroutine_handle<> m_awaiter; + std::coroutine_handle<> m_awaiter; }; } diff --git a/include/cppcoro/async_mutex.hpp b/include/cppcoro/async_mutex.hpp index cc193112..d2f0c9c2 100644 --- a/include/cppcoro/async_mutex.hpp +++ b/include/cppcoro/async_mutex.hpp @@ -166,7 +166,7 @@ namespace cppcoro {} bool await_ready() const noexcept { return false; } - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(std::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept {} protected: @@ -178,7 +178,7 @@ namespace cppcoro private: async_mutex_lock_operation* m_next; - std::experimental::coroutine_handle<> m_awaiter; + std::coroutine_handle<> m_awaiter; }; diff --git a/include/cppcoro/async_scope.hpp b/include/cppcoro/async_scope.hpp index c46b8c6e..c907ad16 100644 --- a/include/cppcoro/async_scope.hpp +++ b/include/cppcoro/async_scope.hpp @@ -52,7 +52,7 @@ namespace cppcoro return m_scope->m_count.load(std::memory_order_acquire) == 0; } - bool await_suspend(std::experimental::coroutine_handle<> continuation) noexcept + bool await_suspend(std::coroutine_handle<> continuation) noexcept { m_scope->m_continuation = continuation; return m_scope->m_count.fetch_sub(1u, std::memory_order_acq_rel) > 1u; @@ -85,8 +85,8 @@ namespace cppcoro { struct promise_type { - std::experimental::suspend_never initial_suspend() { return {}; } - std::experimental::suspend_never final_suspend() { return {}; } + std::suspend_never initial_suspend() { return {}; } + std::suspend_never final_suspend() { return {}; } void unhandled_exception() { std::terminate(); } oneway_task get_return_object() { return {}; } void return_void() {} @@ -94,7 +94,7 @@ namespace cppcoro }; std::atomic m_count; - std::experimental::coroutine_handle<> m_continuation; + std::coroutine_handle<> m_continuation; }; } diff --git a/include/cppcoro/detail/is_awaiter.hpp b/include/cppcoro/detail/is_awaiter.hpp index 1538c8f3..791093cd 100644 --- a/include/cppcoro/detail/is_awaiter.hpp +++ b/include/cppcoro/detail/is_awaiter.hpp @@ -18,7 +18,7 @@ namespace cppcoro {}; template - struct is_coroutine_handle> + struct is_coroutine_handle> : std::true_type {}; @@ -42,12 +42,12 @@ namespace cppcoro template struct is_awaiter().await_ready()), - decltype(std::declval().await_suspend(std::declval>())), + decltype(std::declval().await_suspend(std::declval>())), decltype(std::declval().await_resume())>> : std::conjunction< std::is_constructible().await_ready())>, detail::is_valid_await_suspend_return_value< - decltype(std::declval().await_suspend(std::declval>()))>> + decltype(std::declval().await_suspend(std::declval>()))>> {}; } } diff --git a/include/cppcoro/detail/sync_wait_task.hpp b/include/cppcoro/detail/sync_wait_task.hpp index ee0b9fbc..ff035588 100644 --- a/include/cppcoro/detail/sync_wait_task.hpp +++ b/include/cppcoro/detail/sync_wait_task.hpp @@ -24,7 +24,7 @@ namespace cppcoro template class sync_wait_task_promise final { - using coroutine_handle_t = std::experimental::coroutine_handle>; + using coroutine_handle_t = std::coroutine_handle>; public: @@ -44,7 +44,7 @@ namespace cppcoro return coroutine_handle_t::from_promise(*this); } - std::experimental::suspend_always initial_suspend() noexcept + std::suspend_always initial_suspend() noexcept { return{}; } @@ -89,7 +89,7 @@ namespace cppcoro bool await_ready() noexcept { return true; } - void await_suspend(std::experimental::coroutine_handle<>) noexcept {} + void await_suspend(std::coroutine_handle<>) noexcept {} sync_wait_task_promise& await_resume() noexcept { return *m_promise; @@ -140,7 +140,7 @@ namespace cppcoro template<> class sync_wait_task_promise { - using coroutine_handle_t = std::experimental::coroutine_handle>; + using coroutine_handle_t = std::coroutine_handle>; public: @@ -158,7 +158,7 @@ namespace cppcoro return coroutine_handle_t::from_promise(*this); } - std::experimental::suspend_always initial_suspend() noexcept + std::suspend_always initial_suspend() noexcept { return{}; } @@ -211,7 +211,7 @@ namespace cppcoro using promise_type = sync_wait_task_promise; - using coroutine_handle_t = std::experimental::coroutine_handle; + using coroutine_handle_t = std::coroutine_handle; sync_wait_task(coroutine_handle_t coroutine) noexcept : m_coroutine(coroutine) diff --git a/include/cppcoro/detail/when_all_counter.hpp b/include/cppcoro/detail/when_all_counter.hpp index 5ed8d888..2f4f18ba 100644 --- a/include/cppcoro/detail/when_all_counter.hpp +++ b/include/cppcoro/detail/when_all_counter.hpp @@ -29,7 +29,7 @@ namespace cppcoro return static_cast(m_awaitingCoroutine); } - bool try_await(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool try_await(std::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; return m_count.fetch_sub(1, std::memory_order_acq_rel) > 1; @@ -46,7 +46,7 @@ namespace cppcoro protected: std::atomic m_count; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + std::coroutine_handle<> m_awaitingCoroutine; }; } diff --git a/include/cppcoro/detail/when_all_ready_awaitable.hpp b/include/cppcoro/detail/when_all_ready_awaitable.hpp index 2fe80c68..534b176b 100644 --- a/include/cppcoro/detail/when_all_ready_awaitable.hpp +++ b/include/cppcoro/detail/when_all_ready_awaitable.hpp @@ -26,7 +26,7 @@ namespace cppcoro explicit constexpr when_all_ready_awaitable(std::tuple<>) noexcept {} constexpr bool await_ready() const noexcept { return true; } - void await_suspend(std::experimental::coroutine_handle<>) noexcept {} + void await_suspend(std::coroutine_handle<>) noexcept {} std::tuple<> await_resume() const noexcept { return {}; } }; @@ -66,7 +66,7 @@ namespace cppcoro return m_awaitable.is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { return m_awaitable.try_await(awaitingCoroutine); } @@ -98,7 +98,7 @@ namespace cppcoro return m_awaitable.is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { return m_awaitable.try_await(awaitingCoroutine); } @@ -124,7 +124,7 @@ namespace cppcoro return m_counter.is_ready(); } - bool try_await(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool try_await(std::coroutine_handle<> awaitingCoroutine) noexcept { start_tasks(std::make_integer_sequence{}); return m_counter.try_await(awaitingCoroutine); @@ -177,7 +177,7 @@ namespace cppcoro return m_awaitable.is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { return m_awaitable.try_await(awaitingCoroutine); } @@ -212,7 +212,7 @@ namespace cppcoro return m_awaitable.is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { return m_awaitable.try_await(awaitingCoroutine); } @@ -238,7 +238,7 @@ namespace cppcoro return m_counter.is_ready(); } - bool try_await(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool try_await(std::coroutine_handle<> awaitingCoroutine) noexcept { for (auto&& task : m_tasks) { diff --git a/include/cppcoro/detail/when_all_task.hpp b/include/cppcoro/detail/when_all_task.hpp index abaff33b..ebd248fb 100644 --- a/include/cppcoro/detail/when_all_task.hpp +++ b/include/cppcoro/detail/when_all_task.hpp @@ -28,7 +28,7 @@ namespace cppcoro { public: - using coroutine_handle_t = std::experimental::coroutine_handle>; + using coroutine_handle_t = std::coroutine_handle>; when_all_task_promise() noexcept {} @@ -38,7 +38,7 @@ namespace cppcoro return coroutine_handle_t::from_promise(*this); } - std::experimental::suspend_always initial_suspend() noexcept + std::suspend_always initial_suspend() noexcept { return{}; } @@ -97,7 +97,7 @@ namespace cppcoro bool await_ready() noexcept { return true; } - void await_suspend(std::experimental::coroutine_handle<>) noexcept {} + void await_suspend(std::coroutine_handle<>) noexcept {} when_all_task_promise& await_resume() noexcept { return *m_promise; @@ -155,7 +155,7 @@ namespace cppcoro { public: - using coroutine_handle_t = std::experimental::coroutine_handle>; + using coroutine_handle_t = std::coroutine_handle>; when_all_task_promise() noexcept {} @@ -165,7 +165,7 @@ namespace cppcoro return coroutine_handle_t::from_promise(*this); } - std::experimental::suspend_always initial_suspend() noexcept + std::suspend_always initial_suspend() noexcept { return{}; } diff --git a/include/cppcoro/detail/win32_overlapped_operation.hpp b/include/cppcoro/detail/win32_overlapped_operation.hpp index b921aa15..76845a7c 100644 --- a/include/cppcoro/detail/win32_overlapped_operation.hpp +++ b/include/cppcoro/detail/win32_overlapped_operation.hpp @@ -100,7 +100,7 @@ namespace cppcoro bool await_ready() const noexcept { return false; } CPPCORO_NOINLINE - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) { static_assert(std::is_base_of_v); @@ -127,7 +127,7 @@ namespace cppcoro operation->m_awaitingCoroutine.resume(); } - std::experimental::coroutine_handle<> m_awaitingCoroutine; + std::coroutine_handle<> m_awaitingCoroutine; }; @@ -186,7 +186,7 @@ namespace cppcoro } CPPCORO_NOINLINE - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) { static_assert(std::is_base_of_v); @@ -367,7 +367,7 @@ namespace cppcoro std::atomic m_state; cppcoro::cancellation_token m_cancellationToken; std::optional m_cancellationCallback; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + std::coroutine_handle<> m_awaitingCoroutine; }; } diff --git a/include/cppcoro/file.hpp b/include/cppcoro/file.hpp index aa507537..ab09adfa 100644 --- a/include/cppcoro/file.hpp +++ b/include/cppcoro/file.hpp @@ -40,7 +40,7 @@ namespace cppcoro static detail::win32::safe_handle open( detail::win32::dword_t fileAccess, io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_open_mode openMode, file_share_mode shareMode, file_buffering_mode bufferingMode); diff --git a/include/cppcoro/fmap.hpp b/include/cppcoro/fmap.hpp index 74541e83..959c85b8 100644 --- a/include/cppcoro/fmap.hpp +++ b/include/cppcoro/fmap.hpp @@ -40,7 +40,7 @@ namespace cppcoro } template - decltype(auto) await_suspend(std::experimental::coroutine_handle coro) + decltype(auto) await_suspend(std::coroutine_handle coro) noexcept(noexcept(static_cast(m_awaiter).await_suspend(std::move(coro)))) { return static_cast(m_awaiter).await_suspend(std::move(coro)); diff --git a/include/cppcoro/generator.hpp b/include/cppcoro/generator.hpp index 03a26ce8..22266ea4 100644 --- a/include/cppcoro/generator.hpp +++ b/include/cppcoro/generator.hpp @@ -5,7 +5,7 @@ #ifndef CPPCORO_GENERATOR_HPP_INCLUDED #define CPPCORO_GENERATOR_HPP_INCLUDED -#include +#include #include #include #include @@ -32,19 +32,19 @@ namespace cppcoro generator get_return_object() noexcept; - constexpr std::experimental::suspend_always initial_suspend() const noexcept { return {}; } - constexpr std::experimental::suspend_always final_suspend() const noexcept { return {}; } + constexpr std::suspend_always initial_suspend() const noexcept { return {}; } + constexpr std::suspend_always final_suspend() const noexcept { return {}; } template< typename U = T, std::enable_if_t::value, int> = 0> - std::experimental::suspend_always yield_value(std::remove_reference_t& value) noexcept + std::suspend_always yield_value(std::remove_reference_t& value) noexcept { m_value = std::addressof(value); return {}; } - std::experimental::suspend_always yield_value(std::remove_reference_t&& value) noexcept + std::suspend_always yield_value(std::remove_reference_t&& value) noexcept { m_value = std::addressof(value); return {}; @@ -66,7 +66,7 @@ namespace cppcoro // Don't allow any use of 'co_await' inside the generator coroutine. template - std::experimental::suspend_never await_transform(U&& value) = delete; + std::suspend_never await_transform(U&& value) = delete; void rethrow_if_exception() { @@ -88,7 +88,7 @@ namespace cppcoro template class generator_iterator { - using coroutine_handle = std::experimental::coroutine_handle>; + using coroutine_handle = std::coroutine_handle>; public: @@ -103,7 +103,7 @@ namespace cppcoro generator_iterator() noexcept : m_coroutine(nullptr) {} - + explicit generator_iterator(coroutine_handle coroutine) noexcept : m_coroutine(coroutine) {} @@ -223,11 +223,11 @@ namespace cppcoro friend class detail::generator_promise; - explicit generator(std::experimental::coroutine_handle coroutine) noexcept + explicit generator(std::coroutine_handle coroutine) noexcept : m_coroutine(coroutine) {} - std::experimental::coroutine_handle m_coroutine; + std::coroutine_handle m_coroutine; }; @@ -242,7 +242,7 @@ namespace cppcoro template generator generator_promise::get_return_object() noexcept { - using coroutine_handle = std::experimental::coroutine_handle>; + using coroutine_handle = std::coroutine_handle>; return generator{ coroutine_handle::from_promise(*this) }; } } diff --git a/include/cppcoro/inline_scheduler.hpp b/include/cppcoro/inline_scheduler.hpp index bd439f37..be1ae595 100644 --- a/include/cppcoro/inline_scheduler.hpp +++ b/include/cppcoro/inline_scheduler.hpp @@ -15,7 +15,7 @@ namespace cppcoro inline_scheduler() noexcept = default; - std::experimental::suspend_never schedule() const noexcept + std::suspend_never schedule() const noexcept { return {}; } diff --git a/include/cppcoro/io_service.hpp b/include/cppcoro/io_service.hpp index 6d2a3464..05b38a3c 100644 --- a/include/cppcoro/io_service.hpp +++ b/include/cppcoro/io_service.hpp @@ -192,7 +192,7 @@ namespace cppcoro {} bool await_ready() const noexcept { return false; } - void await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + void await_suspend(std::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept {} private: @@ -201,7 +201,7 @@ namespace cppcoro friend class io_service::timed_schedule_operation; io_service& m_service; - std::experimental::coroutine_handle<> m_awaiter; + std::coroutine_handle<> m_awaiter; schedule_operation* m_next; }; @@ -224,7 +224,7 @@ namespace cppcoro timed_schedule_operation& operator=(const timed_schedule_operation& other) = delete; bool await_ready() const noexcept; - void await_suspend(std::experimental::coroutine_handle<> awaiter); + void await_suspend(std::coroutine_handle<> awaiter); void await_resume(); private: diff --git a/include/cppcoro/multi_producer_sequencer.hpp b/include/cppcoro/multi_producer_sequencer.hpp index 72589c3d..7242862a 100644 --- a/include/cppcoro/multi_producer_sequencer.hpp +++ b/include/cppcoro/multi_producer_sequencer.hpp @@ -194,7 +194,7 @@ namespace cppcoro return m_barrierWait.await_ready(); } - auto await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + auto await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { return m_barrierWait.await_suspend(awaitingCoroutine); } @@ -273,7 +273,7 @@ namespace cppcoro return m_waitOp.await_ready(); } - auto await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + auto await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { return m_waitOp.await_suspend(awaitingCoroutine); } @@ -347,7 +347,7 @@ namespace cppcoro return !TRAITS::precedes(m_lastKnownPublished, m_targetSequence); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; @@ -384,7 +384,7 @@ namespace cppcoro SEQUENCE m_targetSequence; SEQUENCE m_lastKnownPublished; multi_producer_sequencer_wait_operation_base* m_next; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + std::coroutine_handle<> m_awaitingCoroutine; std::atomic m_readyToResume; }; diff --git a/include/cppcoro/read_only_file.hpp b/include/cppcoro/read_only_file.hpp index a836fbc3..6c352958 100644 --- a/include/cppcoro/read_only_file.hpp +++ b/include/cppcoro/read_only_file.hpp @@ -43,7 +43,7 @@ namespace cppcoro [[nodiscard]] static read_only_file open( io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_share_mode shareMode = file_share_mode::read, file_buffering_mode bufferingMode = file_buffering_mode::default_); diff --git a/include/cppcoro/read_write_file.hpp b/include/cppcoro/read_write_file.hpp index f58bea5c..af1acb48 100644 --- a/include/cppcoro/read_write_file.hpp +++ b/include/cppcoro/read_write_file.hpp @@ -49,7 +49,7 @@ namespace cppcoro [[nodiscard]] static read_write_file open( io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_open_mode openMode = file_open_mode::create_or_open, file_share_mode shareMode = file_share_mode::none, file_buffering_mode bufferingMode = file_buffering_mode::default_); diff --git a/include/cppcoro/recursive_generator.hpp b/include/cppcoro/recursive_generator.hpp index 07e4f726..c4c4cbd6 100644 --- a/include/cppcoro/recursive_generator.hpp +++ b/include/cppcoro/recursive_generator.hpp @@ -39,12 +39,12 @@ namespace cppcoro return recursive_generator{ *this }; } - std::experimental::suspend_always initial_suspend() noexcept + std::suspend_always initial_suspend() noexcept { return {}; } - std::experimental::suspend_always final_suspend() noexcept + std::suspend_always final_suspend() noexcept { return {}; } @@ -56,13 +56,13 @@ namespace cppcoro void return_void() noexcept {} - std::experimental::suspend_always yield_value(T& value) noexcept + std::suspend_always yield_value(T& value) noexcept { m_value = std::addressof(value); return {}; } - std::experimental::suspend_always yield_value(T&& value) noexcept + std::suspend_always yield_value(T&& value) noexcept { m_value = std::addressof(value); return {}; @@ -87,7 +87,7 @@ namespace cppcoro return this->m_childPromise == nullptr; } - void await_suspend(std::experimental::coroutine_handle) noexcept + void await_suspend(std::coroutine_handle) noexcept {} void await_resume() @@ -122,11 +122,11 @@ namespace cppcoro // Don't allow any use of 'co_await' inside the recursive_generator coroutine. template - std::experimental::suspend_never await_transform(U&& value) = delete; + std::suspend_never await_transform(U&& value) = delete; void destroy() noexcept { - std::experimental::coroutine_handle::from_promise(*this).destroy(); + std::coroutine_handle::from_promise(*this).destroy(); } void throw_if_exception() @@ -139,7 +139,7 @@ namespace cppcoro bool is_complete() noexcept { - return std::experimental::coroutine_handle::from_promise(*this).done(); + return std::coroutine_handle::from_promise(*this).done(); } T& value() noexcept @@ -167,7 +167,7 @@ namespace cppcoro void resume() noexcept { - std::experimental::coroutine_handle::from_promise(*this).resume(); + std::coroutine_handle::from_promise(*this).resume(); } std::add_pointer_t m_value; diff --git a/include/cppcoro/round_robin_scheduler.hpp b/include/cppcoro/round_robin_scheduler.hpp index 6749c61d..9fe83b6a 100644 --- a/include/cppcoro/round_robin_scheduler.hpp +++ b/include/cppcoro/round_robin_scheduler.hpp @@ -44,8 +44,8 @@ namespace cppcoro return false; } - std::experimental::coroutine_handle<> await_suspend( - std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + std::coroutine_handle<> await_suspend( + std::coroutine_handle<> awaitingCoroutine) noexcept { return m_scheduler.exchange_next(awaitingCoroutine); } @@ -61,7 +61,7 @@ namespace cppcoro public: round_robin_scheduler() noexcept : m_index(0) - , m_noop(std::experimental::noop_coroutine()) + , m_noop(std::noop_coroutine()) { for (size_t i = 0; i < N - 1; ++i) { @@ -104,8 +104,8 @@ namespace cppcoro private: - std::experimental::coroutine_handle exchange_next( - std::experimental::coroutine_handle<> coroutine) noexcept + std::coroutine_handle exchange_next( + std::coroutine_handle<> coroutine) noexcept { auto coroutineToResume = std::exchange( m_scheduler.m_coroutines[m_scheduler.m_index], @@ -115,8 +115,8 @@ namespace cppcoro } size_t m_index; - const std::experimental::coroutine_handle<> m_noop; - std::array, N - 1> m_coroutines; + const std::coroutine_handle<> m_noop; + std::array, N - 1> m_coroutines; }; #endif } diff --git a/include/cppcoro/sequence_barrier.hpp b/include/cppcoro/sequence_barrier.hpp index d23a5c09..0c8d42c5 100644 --- a/include/cppcoro/sequence_barrier.hpp +++ b/include/cppcoro/sequence_barrier.hpp @@ -161,7 +161,7 @@ namespace cppcoro return !TRAITS::precedes(m_lastKnownPublished, m_targetSequence); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; m_barrier.add_awaiter(this); @@ -192,7 +192,7 @@ namespace cppcoro const SEQUENCE m_targetSequence; SEQUENCE m_lastKnownPublished; sequence_barrier_wait_operation_base* m_next; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + std::coroutine_handle<> m_awaitingCoroutine; std::atomic m_readyToResume; }; diff --git a/include/cppcoro/shared_task.hpp b/include/cppcoro/shared_task.hpp index 797ba30a..c34fc089 100644 --- a/include/cppcoro/shared_task.hpp +++ b/include/cppcoro/shared_task.hpp @@ -28,7 +28,7 @@ namespace cppcoro { struct shared_task_waiter { - std::experimental::coroutine_handle<> m_continuation; + std::coroutine_handle<> m_continuation; shared_task_waiter* m_next; }; @@ -41,7 +41,7 @@ namespace cppcoro bool await_ready() const noexcept { return false; } template - void await_suspend(std::experimental::coroutine_handle h) noexcept + void await_suspend(std::coroutine_handle h) noexcept { shared_task_promise_base& promise = h.promise(); @@ -75,11 +75,11 @@ namespace cppcoro shared_task_promise_base() noexcept : m_refCount(1) - , m_waiters(&this->m_waiters) + , m_waiters(&this->m_waiters) , m_exception(nullptr) {} - std::experimental::suspend_always initial_suspend() noexcept { return {}; } + std::suspend_always initial_suspend() noexcept { return {}; } final_awaiter final_suspend() noexcept { return {}; } void unhandled_exception() noexcept @@ -124,7 +124,7 @@ namespace cppcoro /// waiter->m_coroutine will be resumed when the task completes. /// false if the coroutine was already completed and the awaiting /// coroutine can continue without suspending. - bool try_await(shared_task_waiter* waiter, std::experimental::coroutine_handle<> coroutine) + bool try_await(shared_task_waiter* waiter, std::coroutine_handle<> coroutine) { void* const valueReadyValue = this; void* const notStartedValue = &this->m_waiters; @@ -304,10 +304,10 @@ namespace cppcoro struct awaitable_base { - std::experimental::coroutine_handle m_coroutine; + std::coroutine_handle m_coroutine; detail::shared_task_waiter m_waiter; - awaitable_base(std::experimental::coroutine_handle coroutine) noexcept + awaitable_base(std::coroutine_handle coroutine) noexcept : m_coroutine(coroutine) {} @@ -316,7 +316,7 @@ namespace cppcoro return !m_coroutine || m_coroutine.promise().is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept + bool await_suspend(std::coroutine_handle<> awaiter) noexcept { m_waiter.m_continuation = awaiter; return m_coroutine.promise().try_await(&m_waiter, m_coroutine); @@ -329,7 +329,7 @@ namespace cppcoro : m_coroutine(nullptr) {} - explicit shared_task(std::experimental::coroutine_handle coroutine) + explicit shared_task(std::coroutine_handle coroutine) : m_coroutine(coroutine) { // Don't increment the ref-count here since it has already been @@ -452,7 +452,7 @@ namespace cppcoro } } - std::experimental::coroutine_handle m_coroutine; + std::coroutine_handle m_coroutine; }; @@ -480,7 +480,7 @@ namespace cppcoro shared_task shared_task_promise::get_return_object() noexcept { return shared_task{ - std::experimental::coroutine_handle::from_promise(*this) + std::coroutine_handle::from_promise(*this) }; } @@ -488,14 +488,14 @@ namespace cppcoro shared_task shared_task_promise::get_return_object() noexcept { return shared_task{ - std::experimental::coroutine_handle::from_promise(*this) + std::coroutine_handle::from_promise(*this) }; } inline shared_task shared_task_promise::get_return_object() noexcept { return shared_task{ - std::experimental::coroutine_handle::from_promise(*this) + std::coroutine_handle::from_promise(*this) }; } } diff --git a/include/cppcoro/single_consumer_async_auto_reset_event.hpp b/include/cppcoro/single_consumer_async_auto_reset_event.hpp index 821dbe73..b6286771 100644 --- a/include/cppcoro/single_consumer_async_auto_reset_event.hpp +++ b/include/cppcoro/single_consumer_async_auto_reset_event.hpp @@ -26,7 +26,7 @@ namespace cppcoro if (oldValue != nullptr && oldValue != this) { // There was a waiting coroutine that we now need to resume. - auto handle = *static_cast*>(oldValue); + auto handle = *static_cast*>(oldValue); // We also need to transition the state back to 'not set' before // resuming the coroutine. This operation needs to be 'acquire' @@ -53,8 +53,8 @@ namespace cppcoro {} bool await_ready() const noexcept { return false; } - - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; @@ -82,7 +82,7 @@ namespace cppcoro private: const single_consumer_async_auto_reset_event& m_event; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + std::coroutine_handle<> m_awaitingCoroutine; }; return awaiter{ *this }; diff --git a/include/cppcoro/single_consumer_event.hpp b/include/cppcoro/single_consumer_event.hpp index 167311c4..7cda75b0 100644 --- a/include/cppcoro/single_consumer_event.hpp +++ b/include/cppcoro/single_consumer_event.hpp @@ -84,7 +84,7 @@ namespace cppcoro return m_event.is_set(); } - bool await_suspend(std::experimental::coroutine_handle<> awaiter) + bool await_suspend(std::coroutine_handle<> awaiter) { m_event.m_awaiter = awaiter; @@ -120,7 +120,7 @@ namespace cppcoro // by encoding 'not_set' as 0 (nullptr), 'set' as 1 and // 'not_set_consumer_waiting' as a coroutine handle pointer. std::atomic m_state; - std::experimental::coroutine_handle<> m_awaiter; + std::coroutine_handle<> m_awaiter; }; } diff --git a/include/cppcoro/single_producer_sequencer.hpp b/include/cppcoro/single_producer_sequencer.hpp index d0333111..0f36f76f 100644 --- a/include/cppcoro/single_producer_sequencer.hpp +++ b/include/cppcoro/single_producer_sequencer.hpp @@ -160,7 +160,7 @@ namespace cppcoro return m_consumerWaitOperation.await_ready(); } - auto await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + auto await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { return m_consumerWaitOperation.await_suspend(awaitingCoroutine); } @@ -199,7 +199,7 @@ namespace cppcoro return m_consumerWaitOperation.await_ready(); } - auto await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + auto await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { return m_consumerWaitOperation.await_suspend(awaitingCoroutine); } diff --git a/include/cppcoro/static_thread_pool.hpp b/include/cppcoro/static_thread_pool.hpp index 95ef3c50..10839c0c 100644 --- a/include/cppcoro/static_thread_pool.hpp +++ b/include/cppcoro/static_thread_pool.hpp @@ -38,7 +38,7 @@ namespace cppcoro schedule_operation(static_thread_pool* tp) noexcept : m_threadPool(tp) {} bool await_ready() noexcept { return false; } - void await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept; + void await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept; void await_resume() noexcept {} private: @@ -46,7 +46,7 @@ namespace cppcoro friend class static_thread_pool; static_thread_pool* m_threadPool; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + std::coroutine_handle<> m_awaitingCoroutine; schedule_operation* m_next; }; diff --git a/include/cppcoro/task.hpp b/include/cppcoro/task.hpp index 3bff404f..09a95009 100644 --- a/include/cppcoro/task.hpp +++ b/include/cppcoro/task.hpp @@ -36,8 +36,8 @@ namespace cppcoro #if CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER template - std::experimental::coroutine_handle<> await_suspend( - std::experimental::coroutine_handle coro) noexcept + std::coroutine_handle<> await_suspend( + std::coroutine_handle coro) noexcept { return coro.promise().m_continuation; } @@ -49,7 +49,7 @@ namespace cppcoro // were crashing under x86 optimised builds. template CPPCORO_NOINLINE - void await_suspend(std::experimental::coroutine_handle coroutine) + void await_suspend(std::coroutine_handle coroutine) { task_promise_base& promise = coroutine.promise(); @@ -79,7 +79,7 @@ namespace cppcoro auto initial_suspend() noexcept { - return std::experimental::suspend_always{}; + return std::suspend_always{}; } auto final_suspend() noexcept @@ -88,12 +88,12 @@ namespace cppcoro } #if CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER - void set_continuation(std::experimental::coroutine_handle<> continuation) noexcept + void set_continuation(std::coroutine_handle<> continuation) noexcept { m_continuation = continuation; } #else - bool try_set_continuation(std::experimental::coroutine_handle<> continuation) + bool try_set_continuation(std::coroutine_handle<> continuation) { m_continuation = continuation; return !m_state.exchange(true, std::memory_order_acq_rel); @@ -102,7 +102,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle<> m_continuation; + std::coroutine_handle<> m_continuation; #if !CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER // Initially false. Set to true when either a continuation is registered @@ -292,9 +292,9 @@ namespace cppcoro struct awaitable_base { - std::experimental::coroutine_handle m_coroutine; + std::coroutine_handle m_coroutine; - awaitable_base(std::experimental::coroutine_handle coroutine) noexcept + awaitable_base(std::coroutine_handle coroutine) noexcept : m_coroutine(coroutine) {} @@ -304,14 +304,14 @@ namespace cppcoro } #if CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER - std::experimental::coroutine_handle<> await_suspend( - std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + std::coroutine_handle<> await_suspend( + std::coroutine_handle<> awaitingCoroutine) noexcept { m_coroutine.promise().set_continuation(awaitingCoroutine); return m_coroutine; } #else - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(std::coroutine_handle<> awaitingCoroutine) noexcept { // NOTE: We are using the bool-returning version of await_suspend() here // to work around a potential stack-overflow issue if a coroutine @@ -341,7 +341,7 @@ namespace cppcoro : m_coroutine(nullptr) {} - explicit task(std::experimental::coroutine_handle coroutine) + explicit task(std::coroutine_handle coroutine) : m_coroutine(coroutine) {} @@ -446,7 +446,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle m_coroutine; + std::coroutine_handle m_coroutine; }; @@ -455,18 +455,18 @@ namespace cppcoro template task task_promise::get_return_object() noexcept { - return task{ std::experimental::coroutine_handle::from_promise(*this) }; + return task{ std::coroutine_handle::from_promise(*this) }; } inline task task_promise::get_return_object() noexcept { - return task{ std::experimental::coroutine_handle::from_promise(*this) }; + return task{ std::coroutine_handle::from_promise(*this) }; } template task task_promise::get_return_object() noexcept { - return task{ std::experimental::coroutine_handle::from_promise(*this) }; + return task{ std::coroutine_handle::from_promise(*this) }; } } diff --git a/include/cppcoro/write_only_file.hpp b/include/cppcoro/write_only_file.hpp index d3bf627a..1870405b 100644 --- a/include/cppcoro/write_only_file.hpp +++ b/include/cppcoro/write_only_file.hpp @@ -48,7 +48,7 @@ namespace cppcoro [[nodiscard]] static write_only_file open( io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_open_mode openMode = file_open_mode::create_or_open, file_share_mode shareMode = file_share_mode::none, file_buffering_mode bufferingMode = file_buffering_mode::default_); diff --git a/lib/async_auto_reset_event.cpp b/lib/async_auto_reset_event.cpp index 96a2ac98..e2f2f41a 100644 --- a/lib/async_auto_reset_event.cpp +++ b/lib/async_auto_reset_event.cpp @@ -241,7 +241,7 @@ cppcoro::async_auto_reset_event_operation::async_auto_reset_event_operation( {} bool cppcoro::async_auto_reset_event_operation::await_suspend( - std::experimental::coroutine_handle<> awaiter) noexcept + std::coroutine_handle<> awaiter) noexcept { m_awaiter = awaiter; diff --git a/lib/async_manual_reset_event.cpp b/lib/async_manual_reset_event.cpp index 62eebdb3..a3ceb173 100644 --- a/lib/async_manual_reset_event.cpp +++ b/lib/async_manual_reset_event.cpp @@ -72,7 +72,7 @@ bool cppcoro::async_manual_reset_event_operation::await_ready() const noexcept } bool cppcoro::async_manual_reset_event_operation::await_suspend( - std::experimental::coroutine_handle<> awaiter) noexcept + std::coroutine_handle<> awaiter) noexcept { m_awaiter = awaiter; diff --git a/lib/async_mutex.cpp b/lib/async_mutex.cpp index d426d600..463849a0 100644 --- a/lib/async_mutex.cpp +++ b/lib/async_mutex.cpp @@ -70,7 +70,7 @@ void cppcoro::async_mutex::unlock() do { auto* temp = next->m_next; - next->m_next = waitersHead; + next->m_next = waitersHead; waitersHead = next; next = temp; } while (next != nullptr); @@ -85,7 +85,7 @@ void cppcoro::async_mutex::unlock() waitersHead->m_awaiter.resume(); } -bool cppcoro::async_mutex_lock_operation::await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept +bool cppcoro::async_mutex_lock_operation::await_suspend(std::coroutine_handle<> awaiter) noexcept { m_awaiter = awaiter; diff --git a/lib/file.cpp b/lib/file.cpp index 3583217f..f0ce44f0 100644 --- a/lib/file.cpp +++ b/lib/file.cpp @@ -47,7 +47,7 @@ cppcoro::file::file(detail::win32::safe_handle&& fileHandle) noexcept cppcoro::detail::win32::safe_handle cppcoro::file::open( detail::win32::dword_t fileAccess, io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_open_mode openMode, file_share_mode shareMode, file_buffering_mode bufferingMode) diff --git a/lib/io_service.cpp b/lib/io_service.cpp index 393c3ad9..e6e296f5 100644 --- a/lib/io_service.cpp +++ b/lib/io_service.cpp @@ -642,7 +642,7 @@ bool cppcoro::io_service::try_process_one_event(bool waitForEvent) { // This was a coroutine scheduled via a call to // io_service::schedule(). - std::experimental::coroutine_handle<>::from_address( + std::coroutine_handle<>::from_address( reinterpret_cast(completionKey)).resume(); return true; } @@ -911,7 +911,7 @@ void cppcoro::io_service::timer_thread_state::wake_up_timer_thread() noexcept } void cppcoro::io_service::schedule_operation::await_suspend( - std::experimental::coroutine_handle<> awaiter) noexcept + std::coroutine_handle<> awaiter) noexcept { m_awaiter = awaiter; m_service.schedule_impl(this); @@ -947,7 +947,7 @@ bool cppcoro::io_service::timed_schedule_operation::await_ready() const noexcept } void cppcoro::io_service::timed_schedule_operation::await_suspend( - std::experimental::coroutine_handle<> awaiter) + std::coroutine_handle<> awaiter) { m_scheduleOperation.m_awaiter = awaiter; diff --git a/lib/read_only_file.cpp b/lib/read_only_file.cpp index 614aa48a..4c7f00d3 100644 --- a/lib/read_only_file.cpp +++ b/lib/read_only_file.cpp @@ -13,7 +13,7 @@ cppcoro::read_only_file cppcoro::read_only_file::open( io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_share_mode shareMode, file_buffering_mode bufferingMode) { diff --git a/lib/read_write_file.cpp b/lib/read_write_file.cpp index 231e6790..9b4919e3 100644 --- a/lib/read_write_file.cpp +++ b/lib/read_write_file.cpp @@ -13,7 +13,7 @@ cppcoro::read_write_file cppcoro::read_write_file::open( io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_open_mode openMode, file_share_mode shareMode, file_buffering_mode bufferingMode) diff --git a/lib/static_thread_pool.cpp b/lib/static_thread_pool.cpp index 36c39ce9..980f9d34 100644 --- a/lib/static_thread_pool.cpp +++ b/lib/static_thread_pool.cpp @@ -319,7 +319,7 @@ namespace cppcoro }; void static_thread_pool::schedule_operation::await_suspend( - std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + std::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; m_threadPool->schedule_impl(this); @@ -664,7 +664,7 @@ namespace cppcoro return nullptr; } - // Reverse the list + // Reverse the list do { auto* next = std::exchange(tail->m_next, head); diff --git a/lib/write_only_file.cpp b/lib/write_only_file.cpp index 4c91bddf..2440ac75 100644 --- a/lib/write_only_file.cpp +++ b/lib/write_only_file.cpp @@ -13,7 +13,7 @@ cppcoro::write_only_file cppcoro::write_only_file::open( io_service& ioService, - const std::experimental::filesystem::path& path, + const std::filesystem::path& path, file_open_mode openMode, file_share_mode shareMode, file_buffering_mode bufferingMode) diff --git a/test/file_tests.cpp b/test/file_tests.cpp index 41836136..9a2a99ab 100644 --- a/test/file_tests.cpp +++ b/test/file_tests.cpp @@ -25,7 +25,7 @@ TEST_SUITE_BEGIN("file"); -namespace fs = std::experimental::filesystem; +namespace fs = std::filesystem; namespace { @@ -61,14 +61,14 @@ namespace fs::remove_all(m_path); } - const std::experimental::filesystem::path& temp_dir() + const std::filesystem::path& temp_dir() { return m_path; } private: - std::experimental::filesystem::path m_path; + std::filesystem::path m_path; }; diff --git a/test/static_thread_pool_tests.cpp b/test/static_thread_pool_tests.cpp index ce93299d..e7d5f990 100644 --- a/test/static_thread_pool_tests.cpp +++ b/test/static_thread_pool_tests.cpp @@ -132,7 +132,7 @@ TEST_CASE("launch sub-task with many sub-tasks") struct fork_join_operation { std::atomic m_count; - std::experimental::coroutine_handle<> m_coro; + std::coroutine_handle<> m_coro; fork_join_operation() : m_count(1) {} @@ -151,7 +151,7 @@ struct fork_join_operation bool await_ready() noexcept { return m_count.load(std::memory_order_acquire) == 1; } - bool await_suspend(std::experimental::coroutine_handle<> coro) noexcept + bool await_suspend(std::coroutine_handle<> coro) noexcept { m_coro = coro; return m_count.fetch_sub(1, std::memory_order_acq_rel) != 1; @@ -187,7 +187,7 @@ cppcoro::task for_each_async(SCHEDULER& scheduler, RANGE& range, FUNC func bool await_ready() noexcept { return false; } CPPCORO_NOINLINE - void await_suspend(std::experimental::coroutine_handle<> coro) noexcept + void await_suspend(std::coroutine_handle<> coro) noexcept { fork_join_operation& forkJoin = m_forkJoin; FUNC& func = m_func;