Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2704: range lock algorithm fails with iterators
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-01-31 17:11:05
#2704: range lock algorithm fails with iterators
---------------------------------------+------------------------------------
Reporter: jwakely.boost_at_[hidden] | Owner: anthonyw
Type: Bugs | Status: new
Milestone: Boost 1.38.0 | Component: thread
Version: Boost 1.37.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------------+------------------------------------
Comment(by jwakely.boost_at_[hidden]):
gah, I've just noticed that trac concatenated the lines in the original
test case I posted, so that the problem line was commented out. It should
be:
// boost::lock(&v.front(), &v.front()+v.size());
boost::lock(v.begin(), v.end());
the second line is the problem.
Ignore the first patch, it's full of copy&paste errors. The second one
fixes the original test case above, but fails for an iterator type like:
struct iterator : std::vector<boost::mutex>::iterator
{
template<typename T> iterator(T t) :
std::vector<boost::mutex>::iterator(t) { }
iterator() : std::vector<boost::mutex>::iterator() { }
iterator& operator++();
iterator operator++(int);
bool lock(int); // confuses has_member_lock
};
The lock member means substitution succeeds, but the "dummy" parameter
fails to compile because the signature of &U::lock doesn't match.
The third patch handles the case above by extending sfinae_type to only
succeed for members with the right signature.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2704#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC