#ifndef ALSK_ALSK_SKELETON_BONE_FARMSEL_H #define ALSK_ALSK_SKELETON_BONE_FARMSEL_H #include "../bonebase.h" namespace alsk { template struct FarmSel; template< typename Signature, typename Task_, typename TaskLinks_, typename Select_, typename SelectLinks_ > struct FarmSel, tmp::Pack>: SkeletonBase { using Task = Task_; using Select = Select_; using TaskLinks = TaskLinks_; using SelectLinks = SelectLinks_; using Links = tmp::Pack; using PackP = tmp::Parameters; using PackR = Returns; using PackX = tmp::Pack<>; using Packs = arg::Placeholders; Task task; Select select; std::size_t n; }; template<> struct SkeletonTraits { static constexpr bool serial = false; template static constexpr decltype(auto) traverse(std::size_t parDepth, Skeleton&& skeleton, F&& function, T&& init) { using TraverserTask = SkeletonTraversal::Task>; using TraverserSelect = SkeletonTraversal::Select>; return function(parDepth, skeleton, TraverserTask::execute(parDepth+1, skeleton.task, function, std::forward(init)), TraverserSelect::execute(parDepth, skeleton.select, function, std::forward(init)) ); } template static constexpr std::size_t parallelizability(Skeleton&& skeleton) noexcept { return std::forward(skeleton).n; } }; template void skeletonTraversal(FarmSel const& s, F f) { f(s.task, s.n); f(s.select, 1); } } #endif