Boost C++ Libraries: Ticket #4413: wait_for_any hangs up on empty intervals. https://svn.boost.org/trac10/ticket/4413 <p> If range based boost::wait_for_any function is called with an empty interval (first == last) then it will hang up forever. </p> <p> The fix is trivial: if (first == last) </p> <blockquote> <p> return last; </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4413 Trac 1.4.3 Steven Watanabe Fri, 09 Jul 2010 15:41:58 GMT <link>https://svn.boost.org/trac10/ticket/4413#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4413#comment:1</guid> <description> <p> 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. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Anthony Williams</dc:creator> <pubDate>Fri, 09 Jul 2010 19:33:04 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4413#comment:2 https://svn.boost.org/trac10/ticket/4413#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed on trunk </p> Ticket ivg@… Sat, 10 Jul 2010 10:22:35 GMT <link>https://svn.boost.org/trac10/ticket/4413#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4413#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4413#comment:1" title="Comment 1">steven_watanabe</a>: </p> <blockquote class="citation"> <p> 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. </p> </blockquote> <p> The same logic can be applied to a <code>std::find</code>. 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. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Sat, 10 Jul 2010 14:05:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4413#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4413#comment:4</guid> <description> <p> std::find is different. Its behavior when the element is not found is specified as returning the end iterator. The empty range isn't a special case. </p> </description> <category>Ticket</category> </item> </channel> </rss>