[Boost-bugs] [Boost C++ Libraries] #3849: intrusive::unordered_set::suggested_lower_bucket_count

Subject: [Boost-bugs] [Boost C++ Libraries] #3849: intrusive::unordered_set::suggested_lower_bucket_count
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-01-19 21:44:57


#3849: intrusive::unordered_set::suggested_lower_bucket_count
--------------------------+-------------------------------------------------
 Reporter: ef@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: Boost 1.42.0 | Component: intrusive
  Version: Boost 1.41.0 | Severity: Problem
 Keywords: |
--------------------------+-------------------------------------------------
 The above static method crashes or doesn't return the correct value.[[BR]]

 Code in boost 1.41 is:[[BR]]
 static size_type suggested_lower_bucket_count(size_type n)[[BR]]
 {[[BR]]
    const std::size_t *primes =
 &detail::prime_list_holder<0>::prime_list[0];[[BR]]
    const std::size_t *primes_end = primes +
 detail::prime_list_holder<0>::prime_list_size;[[BR]]
    size_type const* bound = std::upper_bound(primes, primes_end, n);[[BR]]
    if(bound != primes_end)[[BR]]
       bound--;[[BR]]
    return size_type(*bound);[[BR]]
 }[[BR]]

 I think it should be:[[BR]]
 static size_type suggested_lower_bucket_count(size_type n)[[BR]]
 {[[BR]]
    const std::size_t *primes =
 &detail::prime_list_holder<0>::prime_list[0];[[BR]]
    const std::size_t *primes_end = primes +
 detail::prime_list_holder<0>::prime_list_size;[[BR]]
    size_type const* bound = std::upper_bound(primes, primes_end, n);[[BR]]
    if('''bound != primes''')[[BR]]
          bound--;[[BR]]
    return size_type(*bound);[[BR]]
 }[[BR]]

 Thank you,[[BR]]
 Etienne

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3849>
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:02 UTC