I have the following piece of code:
void f(){
.....
std::vector<PrepareLogFileThread> v;
for(int i = 0; i < list.length(); ++i){
PrepareLogFileThread a(
list[i],
LOG_TEMPLATE);
a.start();
v.push_back( a );
}
....
}
class PrepareLogFileThread
inherits from a Thread
class that uses pthread
(we use c++98 standard.... and I can use auto_ptr
).
The problem here is that Thread
's copy constructor is private so that is doesn't mess up the execution or something (I am not the author of this class).
The idea here is that I create my PrepareLogFileThread
objects, push_back
to v
, start them and then they all finish before f
returns.
PrepareLogFileThread
has in destructor call to pthread_join
so that it finishes there.
But I can't because I copy a
in line with push_back
.
How can I do it without c++11 and changing Thread
's copy constructor?
I am using gcc 4.4.6 and I can use auto_ptr
.