#ifndef ALSK_ALSK_IMPL_BONE_WHILE_H #define ALSK_ALSK_IMPL_BONE_WHILE_H #include #include #include "../boneimplbase.h" #include "../../skeleton/bone/while.h" namespace alsk { /** * @brief While implementation for any execution */ template struct Impl, Tag, Executor, State>: BoneImplBase, Tag, Executor, State> { using This = Impl; using Test = Execute; using Task = Execute; typename This::Skeleton skeleton; typename This::Executor executor; typename This::StateRef state; constexpr Impl() = default; template constexpr Impl(S&& skeleton, O&& executor, State& state): skeleton{std::forward(skeleton)}, executor{std::forward(executor)}, state{state} {} template constexpr typename This::Return operator()(T& a, T const& b) { auto tupleP = std::forward_as_tuple(a, b); while(executor.template execute(*this, skeleton.test, tupleP, std::tuple<>{})) executor.template execute(*this, skeleton.task, tupleP, std::tuple<>{}); } }; } #endif