I'm having some problems with this program I'm making in C++. For what I'm doing here:
{
GridWorld world;
string input = "";
while (input != "q")
{
thread render(&GridWorld::Render, GridWorld());
render.join();
input = world.GetInput();
thread thread_update(&GridWorld::Update, GridWorld());
thread_update.join();
}
cout << "Thank you for playing\n";
}
It used to work before, but now it is not anymore.
Can someone please help
Have you tried using lambda expressions?
...
thread render([]() { GridWorld().Render(); });
...
thread thread_update([]() { GridWorld().Update(); });
...
Or maybe
...
thread render([&world]() { world.Render(); });
...
thread thread_update([&world]() { world.Update(); });
...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.