As i said in the title im having an issue while trying to print coordinate values like this while using a std::thread
#include <array>
#include <thread>
struct Vec2
{
int x;
int y;
};
void dostuff2(Vec2 x)
{
std::cout << x.x << x.y << " ";
}
void dostuff(Vec2 Oven[3])
{
for (int i=0; i<3; ++i)
{
dostuff2(Oven[i]);
}
}
int main()
{
Vec2 Oven[3]{ {63,21},{63,22},{63,23} };
std::thread thread_obj(dostuff,std::ref(Oven));
thread_obj.detach();
}
Any ideas why this code isnt working? It was working without me executing the function on a seperate thread..