#ifndef ALSK_ALSK_EDSL_OP_IMPL_LOOP_H #define ALSK_ALSK_EDSL_OP_IMPL_LOOP_H #include #include "../traits.h" #include "../../../skeleton/bone/loop.h" #include "../../../skeleton/struct/struct.h" #include "../../../skeleton/link/link.h" namespace alsk { namespace edsl { template struct Farm; template struct Loop: OperandBase { Task task; unsigned int n; constexpr Loop(Task task, unsigned int n) noexcept(noexcept(Task{std::move(task)})): task{std::move(task)}, n{n} {} template constexpr Loop(Loop const& o) noexcept(noexcept(Task{o.task})): task{o.task}, n{o.n} {} template constexpr Loop(Loop&& o) noexcept(noexcept(Task{std::move(o.task)})): task{std::move(o.task)}, n{std::move(o.n)} {} using Signature = Signature_; using Struct = S; using Links = L; template constexpr void setup(S& skeleton) const { skeleton.n = n; setupFor(task, skeleton.task); } template constexpr auto link() const&& { return Loop{std::move(*this)}; } template constexpr auto link() const& { return Loop{*this}; } }; template constexpr auto loop(Task const& task, unsigned int n = 0) { return Loop{task, n}; } template constexpr auto operator&(Farm const& farm) { return Loop{farm.task, farm.n}; } } } #endif