diff --git a/include/continuable/continuable-base.hpp b/include/continuable/continuable-base.hpp index d4185b9..b134852 100644 --- a/include/continuable/continuable-base.hpp +++ b/include/continuable/continuable-base.hpp @@ -70,7 +70,7 @@ namespace cti { /// call the continuable_base::freeze method for disabling the /// invocation on destruction. /// -/// \since version 1.0.0 +/// \since 1.0.0 template class continuable_base { @@ -129,7 +129,7 @@ public: /// The continuable_base::freeze method disables the automatic /// invocation on destruction without invalidating the object. /// - /// \since version 1.0.0 + /// \since 1.0.0 ~continuable_base() { if (ownership_.is_acquired() && !ownership_.is_frozen()) { std::move(*this).done(); @@ -218,7 +218,7 @@ public: /// .then([](std::string atom) { }); // /// ``` /// - /// \since version 1.0.0 + /// \since 1.0.0 template auto then(T&& callback, E&& executor = detail::types::this_thread_executor_tag{}) && { @@ -246,7 +246,7 @@ public: /// \returns Returns a continuable_base representing the next asynchronous /// result to continue within the asynchronous call hierarchy. /// - /// \since version 1.0.0 + /// \since 1.0.0 template auto then(continuable_base&& continuation) && { return std::move(*this).then( @@ -291,7 +291,7 @@ public: /// depending on the previous result type. /// /// - /// \since version 2.0.0 + /// \since 2.0.0 template auto fail(T&& callback, E&& executor = detail::types::this_thread_executor_tag{}) && { @@ -316,7 +316,7 @@ public: /// \returns Returns a continuable_base with an asynchronous return type /// depending on the previous result type. /// - /// \since version 2.0.0 + /// \since 2.0.0 template auto fail(continuable_base&& continuation) && { continuation.freeze(); @@ -350,7 +350,7 @@ public: /// \returns Returns a continuable_base with an asynchronous return type /// depending on the current result type. /// - /// \since version 2.0.0 + /// \since 2.0.0 template auto next(T&& callback, E&& executor = detail::types::this_thread_executor_tag{}) && { @@ -368,7 +368,7 @@ public: /// \returns Returns the result of the given transform when this /// continuable is passed into it. /// - /// \since version 2.0.0 + /// \since 2.0.0 template auto apply(T&& transform) && { return std::forward(transform)(std::move(*this).materialize()); @@ -381,7 +381,7 @@ public: /// \returns See the corresponding continuable_base::then method for the /// explanation of the return type. /// - /// \since version 2.0.0 + /// \since 2.0.0 template auto operator|(T&& right) && { return std::move(*this).then(std::forward(right)); @@ -420,7 +420,7 @@ public: /// Sequential invocation is also supported through the /// continuable_base::operator>> method. /// - /// \since version 1.0.0 + /// \since 1.0.0 template auto operator&&(continuable_base&& right) && { return detail::composition::connect(detail::composition::strategy_all_tag{}, @@ -462,7 +462,7 @@ public: /// current thread, however, the callback is only called once with /// the first result which becomes available. /// - /// \since version 1.0.0 + /// \since 1.0.0 template auto operator||(continuable_base&& right) && { return detail::composition::connect(detail::composition::strategy_any_tag{}, @@ -490,7 +490,7 @@ public: /// current thread. Parallel invocation is also supported through the /// continuable_base::operator&& method. /// - /// \since version 1.0.0 + /// \since 1.0.0 template auto operator>>(continuable_base&& right) && { return detail::composition::sequential_connect(std::move(*this), @@ -506,7 +506,7 @@ public: /// \attention This method will trigger an assertion if the /// continuable_base was released already. /// - /// \since version 1.0.0 + /// \since 1.0.0 void done() && { detail::base::finalize_continuation(std::move(*this)); } @@ -520,7 +520,7 @@ public: /// \attention This method will trigger an assertion if the /// continuable_base was released already. /// - /// \since version 1.0.0 + /// \since 1.0.0 bool is_frozen() const noexcept { assert_acquired(); return ownership_.is_frozen(); @@ -541,7 +541,7 @@ public: /// \attention This method will trigger an assertion if the /// continuable_base was released already. /// - /// \since version 1.0.0 + /// \since 1.0.0 continuable_base& freeze(bool enabled = true) & noexcept { ownership_.freeze(enabled); return *this; @@ -674,7 +674,7 @@ private: /// \note You should always turn the callback into a r-value if possible /// (`std::move` or `std::forward`) for qualifier correct invokation. /// -/// \since version 1.0.0 +/// \since 1.0.0 template auto make_continuable(Continuation&& continuation) { auto hint = detail::composition::annotating::extract( @@ -707,7 +707,7 @@ auto make_continuable(Continuation&& continuation) { /// /// \note see continuable::next for details. /// -/// \since version 2.0.0 +/// \since 2.0.0 using detail::types::dispatch_error_tag; /// Represents the type that is used as error type @@ -718,7 +718,7 @@ using detail::types::dispatch_error_tag; /// A custom error type may be set through /// defining `CONTINUABLE_WITH_CUSTOM_ERROR_TYPE`. /// -/// \since version 2.0.0 +/// \since 2.0.0 using detail::types::error_type; /// Connects the given continuables with an *all* logic. @@ -728,7 +728,7 @@ using detail::types::error_type; /// /// \see continuable_base::operator && for details. /// -/// \since version 1.1.0 +/// \since 1.1.0 template auto when_all(Continuables&&... continuables) { static_assert(sizeof...(continuables) >= 2, @@ -744,7 +744,7 @@ auto when_all(Continuables&&... continuables) { /// /// \see continuable_base::operator|| for details. /// -/// \since version 1.1.0 +/// \since 1.1.0 template auto when_any(Continuables&&... continuables) { static_assert(sizeof...(continuables) >= 2, @@ -760,7 +760,7 @@ auto when_any(Continuables&&... continuables) { /// /// \see continuable_base::operator>> for details. /// -/// \since version 1.1.0 +/// \since 1.1.0 template auto when_seq(Continuables&&... continuables) { static_assert(sizeof...(continuables) >= 2, diff --git a/include/continuable/continuable-promise-base.hpp b/include/continuable/continuable-promise-base.hpp index a3e60d9..6f39b43 100644 --- a/include/continuable/continuable-promise-base.hpp +++ b/include/continuable/continuable-promise-base.hpp @@ -45,7 +45,7 @@ namespace cti { /// Use the promise type defined in `continuable/continuable_types.hpp`, /// in order to use this class. /// -/// \since version 2.0.0 +/// \since 2.0.0 // clang-format off template class promise_base @@ -75,13 +75,13 @@ public: /// Resolves the continuation with the given values /// - /// \since version 2.0.0 + /// \since 2.0.0 void operator()(Args... args) && { std::move(data_)(std::move(args)...); } /// Resolves the continuation with the given exception /// - /// \since version 2.0.0 + /// \since 2.0.0 void operator()(detail::types::dispatch_error_tag tag, detail::types::error_type exception) && { std::move(data_)(tag, std::move(exception)); @@ -89,14 +89,14 @@ public: /// Resolves the continuation with the given values /// - /// \since version 2.0.0 + /// \since 2.0.0 void set_value(Args... args) { std::move(data_)(std::move(args)...); } /// Resolves the continuation with the given exception /// - /// \since version 2.0.0 + /// \since 2.0.0 void set_exception(detail::types::error_type exception) { std::move(data_)(detail::types::dispatch_error_tag{}, std::move(exception)); } diff --git a/include/continuable/continuable-testing.hpp b/include/continuable/continuable-testing.hpp index a269c66..37f2997 100644 --- a/include/continuable/continuable-testing.hpp +++ b/include/continuable/continuable-testing.hpp @@ -37,21 +37,21 @@ /// Asserts that the final callback of the given continuable was called /// with any result. /// -/// \since version 1.0.0 +/// \since 1.0.0 #define ASSERT_ASYNC_COMPLETION(CONTINUABLE) \ cti::detail::testing::assert_async_completion(CONTINUABLE); /// Asserts that the final callback of the given continuable was called /// with any exceptional result. /// -/// \since version 2.0.0 +/// \since 2.0.0 #define ASSERT_ASYNC_EXCEPTION_COMPLETION(CONTINUABLE) \ cti::detail::testing::assert_async_exception_completion(CONTINUABLE); /// Asserts that the final callback of the given continuable is never called /// with any result. /// -/// \since version 1.0.0 +/// \since 1.0.0 #define ASSERT_ASYNC_INCOMPLETION(CONTINUABLE) \ cti::detail::testing::assert_async_never_completed(CONTINUABLE); @@ -87,7 +87,7 @@ /// \note This macro is mainly present for building other assertions /// relying on custom validation logic. /// -/// \since version 1.0.0 +/// \since 1.0.0 #define ASSERT_ASYNC_BINARY_VALIDATION(VALIDATOR, ...) \ cti::detail::testing::assert_async_binary_validation(VALIDATOR, __VA_ARGS__); @@ -98,7 +98,7 @@ /// \note This macro is mainly present for building other assertions /// relying on custom validation logic. /// -/// \since version 2.0.0 +/// \since 2.0.0 #define ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION(VALIDATOR, ...) \ cti::detail::testing::assert_async_binary_exception_validation(VALIDATOR, \ __VA_ARGS__); @@ -112,14 +112,14 @@ /// EXPECT_ASYNC_RESULT(async_get("hello"), "hello"); /// ``` /// -/// \since version 1.0.0 +/// \since 1.0.0 #define EXPECT_ASYNC_RESULT(...) \ ASSERT_ASYNC_BINARY_VALIDATION(cti::detail::testing::expecting_eq_check(), \ __VA_ARGS__) /// Asserts that the continuable is finished with the given exception /// -/// \since version 2.0.0 +/// \since 2.0.0 #define EXPECT_ASYNC_EXCEPTION_RESULT(...) \ ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION( \ cti::detail::testing::expecting_eq_check(), __VA_ARGS__) @@ -133,7 +133,7 @@ /// ASSERT_ASYNC_RESULT(async_get("hello"), "hello"); /// ``` /// -/// \since version 1.0.0 +/// \since 1.0.0 #define ASSERT_ASYNC_RESULT(...) \ ASSERT_ASYNC_BINARY_VALIDATION(cti::detail::testing::asserting_eq_check(), \ __VA_ARGS__) @@ -150,14 +150,14 @@ /// /// \note This is a compile-time assertion. /// -/// \since version 1.0.0 +/// \since 1.0.0 #define ASSERT_ASYNC_TYPES(CONTINUABLE, ...) \ cti::detail::testing::assert_async_types( \ CONTINUABLE, cti::detail::traits::identity<__VA_ARGS__>{}) /// Asserts that the continuable is finished with the given exception /// -/// \since version 2.0.0 +/// \since 2.0.0 #define ASSERT_ASYNC_EXCEPTION_RESULT(...) \ ASSERT_ASYNC_BINARY_EXCEPTION_VALIDATION( \ cti::detail::testing::asserting_eq_check(), __VA_ARGS__) diff --git a/include/continuable/continuable-transforms.hpp b/include/continuable/continuable-transforms.hpp index 765833f..317e9ea 100644 --- a/include/continuable/continuable-transforms.hpp +++ b/include/continuable/continuable-transforms.hpp @@ -59,7 +59,7 @@ namespace transforms { /// call chain! /// Otherwise this will yield a trap that causes application exit. /// -/// \since version 2.0.0 +/// \since 2.0.0 inline auto futurize() { return [](auto&& continuable) { using detail::transforms::as_future; @@ -75,7 +75,7 @@ inline auto futurize() { /// \attention This can be used to create a continuable which doesn't resolve /// the continuation on errors. /// -/// \since version 2.0.0 +/// \since 2.0.0 inline auto flatten() { return [](auto&& continuable) { return std::forward(continuable).fail([](auto&&) {}); diff --git a/include/continuable/continuable-traverse-async.hpp b/include/continuable/continuable-traverse-async.hpp index 80ccd0a..cccec80 100644 --- a/include/continuable/continuable-traverse-async.hpp +++ b/include/continuable/continuable-traverse-async.hpp @@ -38,16 +38,24 @@ namespace cti { /// A tag which is passed to the `operator()` of the visitor /// if an element is visited synchronously. +/// +/// \since 3.0.0 using detail::traversal::async_traverse_visit_tag; /// A tag which is passed to the `operator()` of the visitor /// if an element is visited after the traversal was detached. +/// +/// \since 3.0.0 using detail::traversal::async_traverse_detach_tag; /// A tag which is passed to the `operator()` of the visitor /// if the asynchronous pack traversal was finished. +/// +/// \since 3.0.0 using detail::traversal::async_traverse_complete_tag; /// A tag to identify that a mapper shall be constructed in-place /// from the first argument passed. +/// +/// \since 3.0.0 using detail::traversal::async_traverse_in_place_tag; /// Traverses the pack with the given visitor in an asynchronous way. @@ -103,6 +111,7 @@ using detail::traversal::async_traverse_in_place_tag; /// See `traverse_pack` for a detailed description about the /// traversal behaviour and capabilities. /// +/// \since 3.0.0 template auto traverse_pack_async(Visitor&& visitor, T&&... pack) { return detail::traversal::apply_pack_transform_async( diff --git a/include/continuable/continuable-traverse.hpp b/include/continuable/continuable-traverse.hpp index 5356f39..43d1044 100644 --- a/include/continuable/continuable-traverse.hpp +++ b/include/continuable/continuable-traverse.hpp @@ -69,6 +69,7 @@ namespace cti { /// multiple elements, the pack is wrapped into /// a `std::tuple`. /// +/// \since 3.0.0 template auto map_pack(Mapper&& mapper, T&&... pack) { return detail::traversal::transform(detail::traversal::strategy_remap_tag{}, @@ -79,6 +80,8 @@ auto map_pack(Mapper&& mapper, T&&... pack) { /// Indicate that the result shall be spread across the parent container /// if possible. This can be used to create a mapper function used /// in map_pack that maps one element to an arbitrary count (1:n). +/// +/// \since 3.0.0 template constexpr auto spread_this(T&&... args) noexcept( noexcept(std::make_tuple(std::forward(args)...))) { @@ -92,6 +95,8 @@ constexpr auto spread_this(T&&... args) noexcept( /// however, the result of the mapper isn't preserved. /// /// See `map_pack` for a detailed description. +/// +/// \since 3.0.0 template void traverse_pack(Mapper&& mapper, T&&... pack) { detail::traversal::transform(detail::traversal::strategy_traverse_tag{},