-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reusable continuation chains #22
Comments
I'm glad that you like the library and especially the documentation which took a lot of effort indeed. I thought about reusable continuation chains before and the core library is well suited for such an implementation, when putting connections aside. Currently the plain callback interface looks like this: template<typename... Args>
struct callback {
void operator() (Args...) &&;
void operator() (cti::exception_arg_t, cti::exception_t) &&;
}; Because the library treats continuiables as a use once object the continuation chain which was already invoked is left behind while the chain to come is moved into the next continuation. template<typename... Args>
struct continuation {
void operator() (callback<Args...>);
bool operator() (cti::is_ready_arg_t) const;
std::tuple<Args...> operator() (cti::query_arg_t);
}; Further we call a reusable continuation template<typename... Args>
struct callback {
void operator() (Args...);
void operator() (cti::exception_arg_t, cti::exception_t);
}; The main file which must be changed for this is include/continuable/detail/core/base.hpp through changing the moves to pass by l-value reference.
Further a new wrapper class for Probably it won't be that simple as described above but this is the basic idea I think. |
Thanks for your detailed reply; it will be very useful. I'll report back here with my progress (though it likely won't be for a couple of months). I was hoping to implement connections for |
Basically the (async_generate_some_int() && async_generate_some_chars()).then([] (int a, char b) {
// will wait on pairs such that a and b is available
}) |
Thanks for this fantastic library @Naios. The amount of work you must have put into the documentation is really appreciated.
I'm wondering whether reusable continuation chains are a planned feature, or indeed whether your implementation even permits such a thing? If it is possible, could you please give a brief summary of what would need to be done/how it should be approached? I'd be interested in implementing such a thing and would appreciate your thoughts.
The text was updated successfully, but these errors were encountered: