-
-
Save picanumber/ef63a1848c5189274fea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class F, class... Ts> | |
struct O_Om | |
{ | |
std::tuple<Ts...> nodes; | |
gut::member_result_t<F, decltype(std::get<1>(nodes).clone()), | |
decltype(std::get<0>(nodes).clone())> state; | |
template <class A, class... Us> | |
constexpr O_Om(A&& state, Us&&... args) | |
: nodes{fw(args)...}, state{fw(state)} | |
{ | |
} | |
/* nested iterator type here */ | |
iterator begin() { return iterator(state, 0, nodes); } | |
iterator end() { return iterator(state, sizeof...(Ts), nodes); } | |
constexpr decltype(auto) yield() | |
{ | |
for (std::size_t i(1); i < sizeof...(Ts); ++i) | |
{ | |
state = vtu::call_with_tuple_element_first( | |
F{}, nodes, i, state); | |
} | |
return state; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment