#ifndef ALSK_ALSK_EDSL_OP_IMPL_FARM_H #define ALSK_ALSK_EDSL_OP_IMPL_FARM_H #include #include "../traits.h" #include "../../../skeleton/bone/farm.h" #include "../../../skeleton/struct/struct.h" #include "../../../skeleton/link/link.h" namespace alsk { namespace edsl { template struct FarmSel; template struct Farm: OperandBase { Task task; unsigned int n; constexpr Farm(Task task, unsigned int n) noexcept(noexcept(Task{std::move(task)})): task{std::move(task)}, n{n} {} template constexpr Farm(Farm const& o) noexcept(noexcept(Task{o.task})): task{o.task}, n{o.n} {} template constexpr Farm(Farm&& 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 Farm{std::move(*this)}; } template constexpr auto link() const& { return Farm{*this}; } template>* = nullptr> constexpr auto select(Rhs const& rhs) { return FarmSel(), Task, Rhs>{task, rhs, n}; } }; template>* = nullptr> constexpr auto farm(Task const& task, unsigned int n = 0) { return Farm{task, n}; } template>* = nullptr> constexpr auto operator*(Rhs const& rhs) { return Farm{rhs, 0}; } template>* = nullptr> constexpr auto operator*(unsigned int n, Rhs const& rhs) { return Farm{rhs, n}; } template>* = nullptr> constexpr auto operator*(Lhs const& lhs, unsigned int n) { return Farm{lhs, n}; } } } #endif