https://thispointer.com/c11-start-thread-by-member-function-with-arguments/
Starting thread with non static member function
Suppose we have a class Task, which has non static member function execute() i.e.
Now we want to start a thread which uses execute() function of the class Task as thread function.
As execute() is a non static function of class Task, so first of all we need a object to call this function. Let’s create an object of class Task i.e.
Now let’s create a Thread that will use this member function execute() as thread function through its object i.e.
Here in std::thread constructor we passed 3 arguments i.e.