I wrote a code that create thread and send to him parameters as reference, but I get an red underline under the function name like I cant call it. Someone know what went wrong in my code
my code:
#include "getPrimes.h"
void getPrimes(const int& begin, const int& end, std::vector<int>& primes)
{
int i = 0, j = 0;
for (i = begin; i <= end; i++)
{
if (i > 1)
{
for (j = 2; j <= i / 2; j++)
{
if (i % j != 0)
{
primes.push_back(i);
}
}
}
}
}
std::vector<int> getPrimes(const int& begin, const int& end)
{
std::vector<int> vector;
std::thread thread(getPrimes, std::ref(begin), std::ref(end), std::ref(vector)); // I get the red underline here
}
the error I get
