Some more ideas

This commit is contained in:
Denis Blank 2018-02-19 00:58:45 +01:00
parent 951155bc34
commit 8102c2d841
2 changed files with 57 additions and 7 deletions

View File

@ -364,7 +364,6 @@ public:
// If the traversal method returns false, we detach the
// current execution context and call the visitor with the
// element and a continue callable object again.
frame_->async_continue(*current, std::move(hierarchy));
}
}

View File

@ -22,6 +22,8 @@
#include <string>
#include <system_error>
#include <tuple>
#include <vector>
#include <continuable/continuable.hpp>
@ -117,16 +119,65 @@ void some_requests() {
});
}
namespace cti {
namespace detail {
struct c {};
template <typename C, typename... Args>
struct loc {};
struct runtime_insertion {
std::size_t begin, end;
};
template <typename... Args>
struct future_result {
std::tuple<Args...> result_;
};
template <std::size_t Begin, std::size_t End>
struct static_insertion {};
template <typename... Hierarchy>
struct indexer_frame {
std::tuple<Hierarchy...> hierarchy_;
template <typename T, std::enable_if_t<true>* = nullptr>
auto operator()(T&& continuable) {
}
};
struct result_extractor_mapper {
template <typename T,
std::enable_if_t<is_continuable<std::decay_t<T>>::value>* = nullptr>
auto operator()(T&& continuable) {
}
};
// 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.
} // namespace detail
} // namespace cti
int main(int, char**) {
using namespace cti::detail;
std::vector<int> vc{1, 2, 3};
cti::map_pack(
[](auto&& continuable) {
// ...
return 0;
},
vc);
// std::tuple<c, c, c> t;
// std::tuple<loc<c, ct<0>>, c, c> loc;
cti::map_pack([](auto&& /*continuable*/) { return 0; }, vc);
return 0;
}