#ifndef ALSK_ALSK_SKELETON_BONE_FARM_H #define ALSK_ALSK_SKELETON_BONE_FARM_H #include "../bonebase.h" namespace alsk { template struct Farm; template< typename Signature, typename Task_, typename TaskLinks_ > struct Farm>: SkeletonBase { using Task = Task_; using TaskLinks = TaskLinks_; using Links = tmp::Pack; using PackP = tmp::Parameters; using PackR = Returns; using PackX = tmp::Pack<>; using Packs = arg::Placeholders; Task task; 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 Traverser = SkeletonTraversal::Task>; return function(parDepth, skeleton, Traverser::execute(parDepth+1, skeleton.task, function, std::forward(init))); } template static constexpr std::size_t parallelizability(Skeleton&& skeleton) noexcept { return std::forward(skeleton).n; } }; template void skeletonTraversal(Farm const& s, F&& f) { std::forward(f)(s.task, s.n); } } #endif