#include <iostream>
#include <thread>
#include <vector>
void f(std::vector<double> & vd) {
for (auto & v : vd)
std::cout << "From f -> " << v << std::endl;
}
struct F {
std::vector<double> & vd;
F(std::vector<double> & _vd) : vd{ _vd } {}
void operator() ();
};
void F::operator()() {
for (std::vector<double>::iterator it = vd.begin(); it != vd.end(); ++it)
std::cout << "From F -> " << *it << std::endl;
}
int main() {
std::vector<double> vd{ 2.5, 5.5, 7.1 };
std::vector<double> vd2{ 10.5, 15.5, 21.4 };
//std::thread t0{f, vd}; //<-- Error : No type named type in clas std::result_of))(std::vector&)> Si comento esta linea compila...
std::thread t1{ F(vd2) };
return 0;
}