Boost C++ Libraries: Ticket #3849: intrusive::unordered_set::suggested_lower_bucket_count https://svn.boost.org/trac10/ticket/3849 <p> The above static method crashes or doesn't return the correct value.<br /> </p> <p> Code in boost 1.41 is:<br /> static size_type suggested_lower_bucket_count(size_type n)<br /> {<br /> </p> <blockquote> <p> const std::size_t *primes = &amp;detail::prime_list_holder&lt;0&gt;::prime_list<a class="missing changeset" title="No changeset 0 in the repository">[0]</a>;<br /> const std::size_t *primes_end = primes + detail::prime_list_holder&lt;0&gt;::prime_list_size;<br /> size_type const* bound = std::upper_bound(primes, primes_end, n);<br /> if(bound != primes_end)<br /> </p> <blockquote> <p> bound--;<br /> </p> </blockquote> <p> return size_type(*bound);<br /> </p> </blockquote> <p> }<br /> </p> <p> I think it should be:<br /> static size_type suggested_lower_bucket_count(size_type n)<br /> {<br /> </p> <blockquote> <p> const std::size_t *primes = &amp;detail::prime_list_holder&lt;0&gt;::prime_list<a class="missing changeset" title="No changeset 0 in the repository">[0]</a>;<br /> const std::size_t *primes_end = primes + detail::prime_list_holder&lt;0&gt;::prime_list_size;<br /> size_type const* bound = std::upper_bound(primes, primes_end, n);<br /> if(<strong>bound != primes</strong>)<br /> </p> <blockquote> <p> bound--;<br /> </p> </blockquote> <p> return size_type(*bound);<br /> </p> </blockquote> <p> }<br /> </p> <p> Thank you,<br /> Etienne </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3849 Trac 1.4.3 Etienne Frédéric <ef@…> Fri, 05 Feb 2010 17:57:34 GMT <link>https://svn.boost.org/trac10/ticket/3849#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3849#comment:1</guid> <description> <p> The bug is still there in 1.42. Has somebody at least read this ticket ? Thanks. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Thu, 26 Aug 2010 11:13:55 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/3849#comment:2 https://svn.boost.org/trac10/ticket/3849#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> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.42.0</span> → <span class="trac-field-new">Boost-1.45.0</span> </li> </ul> <p> Fixed for Boost 1.45 in release branch </p> Ticket