diff --git a/test/playground/comp.cpp b/include/continuable/detail/composition_remapping.hpp similarity index 87% rename from test/playground/comp.cpp rename to include/continuable/detail/composition_remapping.hpp index 4b3f6af..de576e5 100644 --- a/test/playground/comp.cpp +++ b/include/continuable/detail/composition_remapping.hpp @@ -1,4 +1,12 @@ + /* + + /~` _ _ _|_. _ _ |_ | _ + \_,(_)| | | || ||_|(_||_)|(/_ + + https://github.com/Naios/continuable + v3.0.0 + Copyright(c) 2015 - 2018 Denis Blank Permission is hereby granted, free of charge, to any person obtaining a copy @@ -20,31 +28,31 @@ SOFTWARE. **/ +#ifndef CONTINUABLE_DETAIL_COMPOSITION_REMAPPING_HPP_INCLUDED +#define CONTINUABLE_DETAIL_COMPOSITION_REMAPPING_HPP_INCLUDED + #include +#include +#include #include #include #include #include -// Devel -#include -#include - namespace cti { namespace detail { +namespace composition { /// This namespace provides utilities for performing compound /// connections between deeply nested continuables and values. /// -/// 0. We create the result pack from the provides values and -/// the async values if those are default constructible, -/// otherwise use a lazy initialization wrapper and unwrap -/// the whole pack when the composition is finished. -/// - value -> value -/// - single async value -> single value -/// - multiple async value -> tuple of async values. -/// -/// 1. +/// We create the result pack from the provides values and +/// the async values if those are default constructible, +/// otherwise use a lazy initialization wrapper and unwrap +/// the whole pack when the composition is finished. +/// - value -> value +/// - single async value -> single value +/// - multiple async value -> tuple of async values. namespace remapping { // Guard object for representing void results struct void_result_guard {}; @@ -221,25 +229,15 @@ struct index_relocator { } }; } // namespace remapping +} // namespace composition } // namespace detail } // namespace cti -int main(int, char**) { +// auto p = std::make_tuple(cti::make_ready_continuable(0) /*, 0, 4, +// std::make_tuple(1, 2), cti::make_ready_continuable(0)*/); - using namespace cti::detail; - using namespace remapping; +// auto r = create_result_pack(std::move(p)); +// auto i = create_index_pack(std::move(p)); +// relocate_index_pack(index_relocator{}, &i, &r); - std::vector vc{1, 2, 3}; - - // std::tuple t; - // std::tuple>, c, c> loc; - - auto p = std::make_tuple(cti::make_ready_continuable(0) /*, 0, 4, - std::make_tuple(1, 2), cti::make_ready_continuable(0)*/); - - auto r = create_result_pack(std::move(p)); - auto i = create_index_pack(std::move(p)); - relocate_index_pack(index_relocator{}, &i, &r); - - return 0; -} +#endif // CONTINUABLE_DETAIL_COMPOSITION_REMAPPING_HPP_INCLUDED diff --git a/test/playground/CMakeLists.txt b/test/playground/CMakeLists.txt index 35c3f05..b8aa36d 100644 --- a/test/playground/CMakeLists.txt +++ b/test/playground/CMakeLists.txt @@ -4,8 +4,7 @@ file(GLOB LIB_SOURCES ${INCLUDE_DIR}/*.hpp) file(GLOB_RECURSE LIB_SOURCES_DETAIL ${INCLUDE_DIR}/detail/*.hpp) set(TEST - ${CMAKE_CURRENT_LIST_DIR}/test-playground.cpp - ${CMAKE_CURRENT_LIST_DIR}/comp.cpp) + ${CMAKE_CURRENT_LIST_DIR}/test-playground.cpp) add_executable(test-playground ${LIB_SOURCES} diff --git a/test/playground/test-playground.cpp b/test/playground/test-playground.cpp index 28ef5a5..766c862 100644 --- a/test/playground/test-playground.cpp +++ b/test/playground/test-playground.cpp @@ -68,7 +68,7 @@ struct my_callable { } }; -void some_requests() { +int main(int, char**) { http_request("github.com").next(my_callable{}); http_request("github.com") | [](std::string) {