Boost logo

Boost Users :

Subject: [Boost-users] [future] [Visual Studio 8.0] [1.42.0] Include File compiler failure
From: Robert Douglas (rwdougla_at_[hidden])
Date: 2010-04-13 17:58:16


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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net