Reputation: 1838
I would greatly appreciate any help here. I am trying to call a function asynchronously with Boost::Thread, but I am getting some errors. This is my real code.
In main:
vector<std::string> a = ...;
vector<std::string> b = ...;
vector<boost::thread> threads;
threads.push_back(boost::thread(do_work, an_integer, a[i], b.begin(), b.end()));
// Later I will join()...
Elsewhere:
void do_work(int i, std::string a_string, vector<string>::iterator begin, vector<string>::iterator end)
{
// Some stuff
}
I am quite new to this stuff, being much more used to C#. Anyway, these are the errors I am getting:
error C2664: 'void (int,std::string,std::_Vector_iterator<_Myvec>,std::_Vector_iterator<_Myvec>)' : cannot convert parameter 1 from 'std::_Vector_iterator<_Myvec>' to 'int'
error C2664: 'void (int,std::string,std::_Vector_iterator<_Myvec>,std::_Vector_iterator<_Myvec>)' : cannot convert parameter 3 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'std::_Vector_iterator<_Myvec>'
error C2664: 'void (int,std::string,std::_Vector_iterator<_Myvec>,std::_Vector_iterator<_Myvec>)' : cannot convert parameter 4 from 'std::_Vector_iterator<_Myvec>' to 'std::_Vector_iterator<_Myvec>'
I would greatly appreciate any help you could offer. I am almost certainly doing something extremely inane! Thanks a lot.
Upvotes: 0
Views: 255
Reputation: 37930
That compiler error says that b.begin()
and b.end()
are different types, which clearly can't be in the code you've listed. Recheck your code to make sure you haven't defined b
to be something else. (Also check an_integer
since the compiler believes it's an iterator.)
Upvotes: 1