Skip to content

Instantly share code, notes, and snippets.

@matthiasvegh
Created December 29, 2013 14:56
Show Gist options
  • Save matthiasvegh/8171184 to your computer and use it in GitHub Desktop.
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.
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