Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4413: wait_for_any hangs up on empty intervals.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-07-10 10:22:36
#4413: wait_for_any hangs up on empty intervals.
---------------------------+------------------------------------------------
Reporter: ivg@⦠| Owner: anthonyw
Type: Bugs | Status: closed
Milestone: Boost 1.44.0 | Component: thread
Version: Boost 1.44.0 | Severity: Problem
Resolution: fixed | Keywords:
---------------------------+------------------------------------------------
Comment (by ivg@â¦):
Replying to [comment:1 steven_watanabe]:
> I'm not sure that wait_for_any with an empty range should be supported.
Since there are no elements in the range, the conditions under which it
should wake up are never satisfied.
The same logic can be applied to a `std::find`. If a range is empty, then
there are no elements in the range that can satisfy a predicate. So we can
hang over, or remove all data on a hard disk...
Please, look at STL - every algorithm that returns an iterator, will
return the last iterator (or the first) of the range, and will not hang
up. It is idiomatic for algorithms to accept an empty range. This is what
most programmers would expect from this function and all other functions
that have an iterator based input.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4413#comment:3> 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:50:03 UTC