Using:
Boost 1.42.0
Visual Studio 2.0.50727 SP2
I have a managed C++ project which exposes a set of C++ utilities as a dll. One particular file transitively includes future.hpp. Deep in future.hpp's detail namespace, it comes across:
<code>
struct all_futures_lock
{
unsigned count;
boost::scoped_array<boost::unique_lock<boost::mutex> > locks;
all_futures_lock(std::vector<registered_waiter>& futures):
count(futures.size()),locks(new boost::unique_lock<boost::mutex>[count])
{
for(unsigned i=0;i<count;++i)
{
locks[i]=boost::unique_lock<boost::mutex>(futures[i].future->mutex);
}
}
...
void unlock()
{
for(unsigned i=0;i<count;++i)
{
locks[i].unlock();
}
}
};
</code>
the line :
locks[i].unlock();
fails with the following error:
<a path>\v1_42_0\include\boost/thread/future.hpp(414) : error C2666: 'boost::scoped_array<T>::operator []' : 2 overloads have similar conversions
1> with
1> [
1> T=boost::unique_lock<boost::mutex>
1> ]
1> <a path>\boost\v1_42_0\include\boost/smart_ptr/scoped_array.hpp(77): could be 'boost::unique_lock<Mutex> &boost::scoped_array<T>::operator [](ptrdiff_t) const'
1> with
1> [
1> Mutex=boost::mutex,
1> T=boost::unique_lock<boost::mutex>
1> ]
1> or 'built-in C++ operator[(void (__cdecl *)(boost::scoped_array<T> ***), unsigned int)'
1> with
1> [
1> T=boost::unique_lock<boost::mutex>
1> ]
1> while trying to match the argument list '(boost::scoped_array<T>, unsigned int)'
1> with
1> [
1> T=boost::unique_lock<boost::mutex>
1> ]
Does anyone have any idea what is causing this, and how I might go about resolving it?
Sorry if this has ever been brought up, but I could not find anything about this issue in google searches or this mailing list.
Thanks in Advance!
-RD