#ifndef ALSK_ALSK_IMPL_BONE_ITERSEL_H #define ALSK_ALSK_IMPL_BONE_ITERSEL_H #include #include #include #include "../boneimplbase.h" #include "../../skeleton/bone/itersel.h" namespace alsk { /** * @brief IterSel implementation for any execution */ template struct Impl, Tag, Executor, State>: BoneImplBase, Tag, Executor, State> { using This = Impl; using Task = Execute; using Select = 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} {} // TODO check repeatability with tag::Parallel constexpr typename This::Return operator()(Args... args) { using Value = typename This::Return; auto tupleP = std::forward_as_tuple(args...); Value best = ArgGet>::get(tupleP, std::tuple<>{}, std::tuple<>{}); for(std::size_t i = 0; i < skeleton.n; ++i) { Value current = executor.template execute(*this, skeleton.task, tupleP, std::tuple<>{}, best); best = executor.template execute