Boost C++ Libraries: Ticket #2841: boost::hash to support boost::dynamic_bitset https://svn.boost.org/trac10/ticket/2841 <p> IIUC, there's no out-of-box support for hashing of dynamic_bitset. </p> <p> Could something as simple as </p> <div class="wiki-code"><div class="code"><pre> <span class="k">template</span> <span class="o">&lt;</span><span class="k">typename</span> <span class="n">B</span><span class="p">,</span> <span class="k">typename</span> <span class="n">A</span><span class="o">&gt;</span> <span class="k">friend</span> <span class="n">std</span><span class="o">::</span><span class="kt">size_t</span> <span class="n">hash_value</span><span class="p">(</span><span class="k">const</span> <span class="n">dynamic_bitset</span><span class="o">&lt;</span><span class="n">B</span><span class="p">,</span> <span class="n">A</span><span class="o">&gt;&amp;</span> <span class="n">v</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">hash_value</span><span class="p">(</span> <span class="n">v</span><span class="p">.</span><span class="n">m_bits</span> <span class="p">);</span> <span class="p">}</span> </pre></div></div><p> be added to <code>boost::dynamic_bitset</code> class? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2841 Trac 1.4.3 Daniel James Mon, 09 Mar 2009 21:46:53 GMT owner, component changed; cc set https://svn.boost.org/trac10/ticket/2841#comment:1 https://svn.boost.org/trac10/ticket/2841#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">daniel_james@…</span> added </li> <li><strong>owner</strong> changed from <span class="trac-author">Daniel James</span> to <span class="trac-author">Gennaro Prota</span> </li> <li><strong>component</strong> <span class="trac-field-old">hash</span> → <span class="trac-field-new">dynamic_bitset</span> </li> </ul> <p> I don't know anything about dynamic_bitset, but I suspect the hash function will also need to include the length of the bitset so that '1', '10' and '01' all have different hash values. </p> <p> Anyway, this needs to be implemented as part of dynamic_bitset so I'm passing it to it's maintainer. But I'm adding myself as a CC, so he can ask for assistance if needed. </p> Ticket anonymous Mon, 09 Mar 2009 22:01:22 GMT <link>https://svn.boost.org/trac10/ticket/2841#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2841#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2841#comment:1" title="Comment 1">danieljames</a>: </p> <blockquote class="citation"> <p> I don't know anything about dynamic_bitset, but I suspect the hash function will also need to include the length of the bitset so that '1', '10' and '01' all have different hash values. </p> </blockquote> <p> Well, yes, adding length may improve hashing quality. On the other hand, the length of <code>m_bits</code> array directly correlates with the length of bitset, so it's (kind of) already included. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Mon, 09 Mar 2009 22:17:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2841#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2841#comment:3</guid> <description> <p> '0', '00', '000' and '0000' should have different hash values, but unless I've misunderstood dynamic_bitset m_bits will be the same for all of them. </p> </description> <category>Ticket</category> </item> <item> <author>astukalov@…</author> <pubDate>Mon, 09 Mar 2009 22:36:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2841#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2841#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2841#comment:3" title="Comment 3">danieljames</a>: </p> <blockquote class="citation"> <p> '0', '00', '000' and '0000' should have different hash values, but unless I've misunderstood dynamic_bitset m_bits will be the same for all of them. </p> </blockquote> <p> I think so too. It should be true for all zero bitsets with lengths &lt;= bits per bitset block. For bigger lengths - two and more values would be hash_combined, resulting in different hash key. </p> <p> Anyway, not including bitset length into hashing directly would have so small performance improvement, that I withdraw my previous comment. :) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>cheapest Cialis next day delivery</dc:creator> <pubDate>Mon, 08 Jun 2009 11:16:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2841#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2841#comment:5</guid> <description> <p> "Cogito ergo I'm right and you're wrong." </p> <blockquote> <p> -- Blair Houghton </p> </blockquote> <p> <a class="ext-link" href="http://www.nuovosito.com/detail/3814/compra-viagra-italia-%3E-acquista-viagra-originale-e-generico-online.html"><span class="icon">​</span>viagra prezzo online</a> <a class="ext-link" href="http://www.gomedia.us/forum/member.php?u=1621"><span class="icon">​</span>purchase fioricet</a> <a class="ext-link" href="http://us.lexusownersclub.com/forums/index.php?showuser=95591"><span class="icon">​</span>buy order cialis online</a> BgnAuHX <a class="ext-link" href="http://www.maclife.com/user/buy_tramadol_0"><span class="icon">​</span>tramadol buy cheap</a> </p> </description> <category>Ticket</category> </item> <item> <author>jim@…</author> <pubDate>Sun, 25 Aug 2013 07:28:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/2841#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2841#comment:6</guid> <description> <p> It would also be great if <code>dynamic_bitset</code> supported <code>std::hash</code>, which exists beginning with C++11. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>acharles</dc:creator> <pubDate>Wed, 19 Feb 2014 04:49:05 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/2841#comment:7 https://svn.boost.org/trac10/ticket/2841#comment:7 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Gennaro Prota</span> to <span class="trac-author">acharles</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Proposed fix in: <a class="ext-link" href="https://github.com/boostorg/dynamic_bitset/pull/1"><span class="icon">​</span>https://github.com/boostorg/dynamic_bitset/pull/1</a> </p> Ticket acharles Fri, 21 Feb 2014 09:24:55 GMT milestone changed https://svn.boost.org/trac10/ticket/2841#comment:8 https://svn.boost.org/trac10/ticket/2841#comment:8 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.39.0</span> → <span class="trac-field-new">Boost 1.56.0</span> </li> </ul> Ticket paulo@… Wed, 14 Jan 2015 00:48:08 GMT <link>https://svn.boost.org/trac10/ticket/2841#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2841#comment:9</guid> <description> <p> What's needed to actually get this done? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>XRumerTest</dc:creator> <pubDate>Sat, 14 Feb 2015 06:47:25 GMT</pubDate> <title>version, milestone changed https://svn.boost.org/trac10/ticket/2841#comment:10 https://svn.boost.org/trac10/ticket/2841#comment:10 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.38.0</span> → <span class="trac-field-new">Boost 1.43.0</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.56.0</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> <p> Hello. And Bye. </p> Ticket akim.demaille@… Tue, 03 Mar 2015 09:59:04 GMT <link>https://svn.boost.org/trac10/ticket/2841#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2841#comment:11</guid> <description> <p> Ping. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>James E. King, III</dc:creator> <pubDate>Thu, 06 Jun 2019 13:55:57 GMT</pubDate> <title>owner, status, severity changed; milestone deleted https://svn.boost.org/trac10/ticket/2841#comment:12 https://svn.boost.org/trac10/ticket/2841#comment:12 <ul> <li><strong>owner</strong> changed from <span class="trac-author">acharles</span> to <span class="trac-author">James E. King, III</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Optimization</span> → <span class="trac-field-new">Not Applicable</span> </li> <li><strong>milestone</strong> <span class="trac-field-deleted">Boost 1.58.0</span> </li> </ul> Ticket James E. King, III Thu, 06 Jun 2019 13:56:16 GMT <link>https://svn.boost.org/trac10/ticket/2841#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2841#comment:13</guid> <description> <p> <a class="ext-link" href="https://github.com/boostorg/dynamic_bitset/pull/45"><span class="icon">​</span>https://github.com/boostorg/dynamic_bitset/pull/45</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>