71 lines
2.0 KiB
C++
71 lines
2.0 KiB
C++
#ifndef ALSK_ALSK_EDSL_OP_IMPL_FARMSEL_H
|
|
#define ALSK_ALSK_EDSL_OP_IMPL_FARMSEL_H
|
|
|
|
#include <utility>
|
|
|
|
#include "../traits.h"
|
|
#include "../../../skeleton/bone/farmsel.h"
|
|
#include "../../../skeleton/struct/struct.h"
|
|
#include "../../../skeleton/link/link.h"
|
|
|
|
namespace alsk {
|
|
namespace edsl {
|
|
|
|
template<typename, typename> struct Farm;
|
|
|
|
template<typename Signature_, typename Task, typename Select>
|
|
struct FarmSel: OperandBase {
|
|
Task task;
|
|
Select select;
|
|
unsigned int n;
|
|
|
|
constexpr FarmSel(Task task, Select select, unsigned int n)
|
|
noexcept(noexcept(Task{std::move(task)}) and noexcept(Select{std::move(select)})):
|
|
task{std::move(task)}, select{std::move(select)}, n{n}
|
|
{}
|
|
|
|
template<typename S>
|
|
constexpr FarmSel(FarmSel<S, Task, Select> const& o)
|
|
noexcept(noexcept(Task{o.task}) and noexcept(Select{o.select})):
|
|
task{o.task}, select{o.select}, n{o.n}
|
|
{}
|
|
|
|
template<typename S>
|
|
constexpr FarmSel(FarmSel<S, Task, Select>&& o)
|
|
noexcept(noexcept(Task{std::move(o.task)}) and noexcept(Select{std::move(o.select)})):
|
|
task{std::move(o.task)}, select{std::move(o.select)}, n{std::move(o.n)}
|
|
{}
|
|
|
|
using Signature = Signature_;
|
|
|
|
using Struct = S<alsk::FarmSel, typename Task::Struct, typename Select::Struct>;
|
|
using Links = L<alsk::FarmSel, Signature, typename Task::Links, typename Select::Links>;
|
|
|
|
template<typename S>
|
|
constexpr void setup(S& skeleton) const {
|
|
skeleton.n = n;
|
|
setupFor(task, skeleton.task);
|
|
setupFor(select, skeleton.select);
|
|
}
|
|
|
|
template<typename Signature>
|
|
constexpr auto link() const&& {
|
|
return FarmSel<Signature, Task, Select>{std::move(*this)};
|
|
}
|
|
|
|
template<typename Signature>
|
|
constexpr auto link() const& {
|
|
return FarmSel<Signature, Task, Select>{*this};
|
|
}
|
|
};
|
|
|
|
template<typename FR, typename... FArgs, typename Task, typename Rhs, std::enable_if_t<isOperand<Rhs>>* = nullptr>
|
|
constexpr auto operator->*(Farm<FR(FArgs...), Task> const& farm, Rhs const& rhs) {
|
|
return FarmSel<GetReturnType<Rhs>(FArgs...), Task, Rhs>{farm.task, rhs, farm.n};
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
#endif
|