[Boost-bugs] [Boost C++ Libraries] #13136: Regression: intrusive::unordered_set::rehash now requires T to be hashable

Subject: [Boost-bugs] [Boost C++ Libraries] #13136: Regression: intrusive::unordered_set::rehash now requires T to be hashable
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-07-25 19:45:13


#13136: Regression: intrusive::unordered_set::rehash now requires T to be hashable
------------------------------+---------------------------
 Reporter: gromer@… | Owner: Ion Gaztañaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: intrusive
  Version: Boost 1.64.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------
 It is possible to create an `intrusive::unordered_set<T>` where `T` is not
 hashable, so long as you never use methods that perform hashing (e.g.
 insertion is performed via `insert_check` and `insert_commit`, and lookup
 is performed with a caller-specified hasher). `rehash` is documented as
 not calling the hash function if `store_hash` is true, so it ought to be
 callable on a set with that option enabled, and as of Boost 1.60.0 it was.
 However, as of Boost 1.64.0 calls to `rehash` on such a set no longer
 compile, because the generated code now includes a call to the hash
 function (which will never actually be executed).

 Suggested fix: make `do_full_rehash` a non-type template parameter rather
 than a function parameter of `rehash_impl`, and encapsulate the
 `if(do_full_rehash)` logic behind a function template that takes
 `do_full_rehash` as a template argument (with the two branches as
 different specializations). That way the code that calls the hash function
 will not be generated unless the user actually calls `full_rehash`.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13136>
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-07-25 19:48:20 UTC