I have a function that takes in a parameter pack of vectors, These vectors will be of the same length, and I want to call a function with the values of both of these vectors at each index.
For example I pass in a function which prints out two integers that I pass in. I would put in two vectors of integers to the function, and it will call the function I pass in for each of the indexes, The code may help explain what i want to do
#include <iostream>
#include <thread>
#include <functional>
#include <vector>
template<
typename RETURN,
typename ... INPUTS
>
std::vector<RETURN> thread_transform(std::function<RETURN(INPUTS ...)> function, std::vector<INPUTS>& ... inputs)
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
/* Code to loop over the vectors in 'inputs' and call 'function' with */
}
int func(int a, int b)
{
std::cout << a << ' ' << b << std::endl;
}
int main(int argc, char** argv)
{
std::vector<int> a;
std::vector<int> b;
std::vector<int> ret = thread_transform(std::function<int(int, int)>(func), a, b);
return 0;
}