From 20c54f54cb5edcc07583f85e1603a5dfc0483575 Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Wed, 11 Oct 2017 17:04:01 +0200 Subject: [PATCH] Move transforms in their own toplevel namespace --- include/continuable/continuable-transforms.hpp | 7 +++++++ test/unit-test/test-continuable-transforms.cpp | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/continuable/continuable-transforms.hpp b/include/continuable/continuable-transforms.hpp index 38c3efc..ae9b2ca 100644 --- a/include/continuable/continuable-transforms.hpp +++ b/include/continuable/continuable-transforms.hpp @@ -35,6 +35,12 @@ #include namespace cti { +/// The namespace transforms declares callable objects that transform +/// any continuable_base to an object or to a continuable_base itself. +/// +/// Transforms can be applied to continuables through using +/// the continuable-base::apply method accordingly. +namespace transforms { /// Returns a transform that if applied to a continuable, /// it will start the continuation chain and returns the asynchronous /// result as `std::future<...>`. @@ -76,6 +82,7 @@ inline auto flatten() { return std::forward(continuable).fail([](auto&&) {}); }; } +} // namespace transforms } // namespace cti #endif // CONTINUABLE_TRANSFORMS_HPP_INCLUDED__ diff --git a/test/unit-test/test-continuable-transforms.cpp b/test/unit-test/test-continuable-transforms.cpp index 0669ee9..5f1573c 100644 --- a/test/unit-test/test-continuable-transforms.cpp +++ b/test/unit-test/test-continuable-transforms.cpp @@ -36,7 +36,7 @@ bool is_ready(T& future) { TYPED_TEST(single_dimension_tests, are_convertible_to_futures) { { - auto future = this->supply().apply(cti::futurize()); + auto future = this->supply().apply(cti::transforms::futurize()); ASSERT_TRUE(is_ready(future)); future.get(); } @@ -47,7 +47,7 @@ TYPED_TEST(single_dimension_tests, are_convertible_to_futures) { // ... return 0xFD; }) - .apply(cti::futurize()); + .apply(cti::transforms::futurize()); ASSERT_TRUE(is_ready(future)); EXPECT_EQ(future.get(), 0xFD); @@ -69,8 +69,8 @@ TYPED_TEST(single_dimension_tests, are_convertible_to_futures) { } TYPED_TEST(single_dimension_tests, are_flattable) { - auto continuation = - this->supply_exception(supply_test_exception()).apply(cti::flatten()); + auto continuation = this->supply_exception(supply_test_exception()) + .apply(cti::transforms::flatten()); ASSERT_ASYNC_INCOMPLETION(std::move(continuation)); }