Created
December 29, 2013 14:56
-
-
Save matthiasvegh/8171184 to your computer and use it in GitHub Desktop.
Pipeliner prototype for the composition of many functions to be called on many objects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
struct ThreadWrapper { | |
/* ... */ | |
}; | |
template<typename T, typename Ts...> | |
class PipelineFunctions { | |
public: | |
PipelineFunctions() { | |
/* ... */ | |
} | |
template<typename U> | |
decltype(auto) operator(const std::vector<U>& vec) { | |
std::vector<Last<T, Ts...>::type(vec.front())> result; | |
for(const auto& value: vec) { | |
threads[0].send(value); | |
} | |
result.push_back(threads[sizeof...(Ts)].get()); | |
} | |
private: | |
std::array<ThreadWrapper, sizeof...(Ts)+1> threads; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment