I have thread spawning function which accepts many parameters which have default values in the declaration.
int spawn( funcptr func, void arg = 0,int grp_id = 1,const charthreadname);
I want to initialize first parameter func and the last parameter thread name and remaining variables assigned their default values.
spawn( myfunc,”My Thread”);
How can I do this.
You can’t.
Other languages support things like
spawn(myfunc, , , "MyThread"), but not C++.Instead, just overload it to your liking: