#ifndef ALSK_ALSK_EDSL_OP_IMPL_WHILE_H #define ALSK_ALSK_EDSL_OP_IMPL_WHILE_H #include #include "../traits.h" #include "../../../skeleton/bone/while.h" #include "../../../skeleton/struct/struct.h" #include "../../../skeleton/link/link.h" namespace alsk { namespace edsl { template struct While: OperandBase { Cond cond; Task task; constexpr While(Cond cond, Task task) noexcept(noexcept(Cond{std::move(cond)}) and noexcept(Task{std::move(task)})): cond{std::move(cond)}, task{std::move(task)} {} template constexpr While(While const& o) noexcept(noexcept(Cond{o.cond}) and noexcept(Task{o.task})): cond{o.cond}, task{o.task} {} template constexpr While(While&& o) noexcept(noexcept(Cond{std::move(o.cond)}) and noexcept(Task{std::move(o.task)})): cond{std::move(o.cond)}, task{std::move(o.task)} {} using Signature = Signature_; using Struct = S; using Links = L; template constexpr void setup(S& skeleton) const { setupFor(cond, skeleton.cond); setupFor(task, skeleton.task); } template constexpr auto link() const&& { return While{std::move(*this)}; } template constexpr auto link() const& { return While{*this}; } }; namespace impl { template struct WhilePart { Cond const& cond; template>* = nullptr> constexpr auto do_(Task const& task) { return alsk::edsl::While{cond, task}; } }; } template>* = nullptr> constexpr auto while_(Cond const& cond) { return impl::WhilePart{cond}; } } } #endif