Boost C++ Libraries: Ticket #11145: Unable to hash char16_t or char32_t https://svn.boost.org/trac10/ticket/11145 <p> boost::hash doesn't work on char16_t or char32_t data. This did work previously (at least as recently as boost 1.49). There doesn't seem to have been a hash_value overload for them, but it looks like they were implicitly converted to something that was supported. </p> <h3 class="section" id="ReproductionCode">Reproduction Code</h3> <pre class="wiki">#include &lt;boost/functional/hash.hpp&gt; #include &lt;string&gt; void foo() { std::u16string s; auto h = boost::hash&lt;decltype(s)&gt;()(s); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11145 Trac 1.4.3 dave.lowell@… Wed, 25 Mar 2015 14:46:02 GMT <link>https://svn.boost.org/trac10/ticket/11145#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11145#comment:1</guid> <description> <p> I have a patched version of boost/functional/hash/hash.hpp which works with char16_t and char32_t, but I can't seem to attach it (the spam filter is unhappy with it). </p> <p> Basically the change is the addition of the following: </p> <pre class="wiki">#if !defined(BOOST_NO_CXX11_CHAR16_T) template &lt;&gt; struct basic_numbers&lt;char16_t&gt; : boost::hash_detail::enable_hash_value {}; #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) template &lt;&gt; struct basic_numbers&lt;char32_t&gt; : boost::hash_detail::enable_hash_value {}; #endif </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Wed, 17 Feb 2016 18:41:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11145#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11145#comment:2</guid> <description> <p> This one has just hit me as well... any progress? </p> </description> <category>Ticket</category> </item> <item> <author>Tino Didriksen <mail@…></author> <pubDate>Wed, 31 May 2017 07:28:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11145#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11145#comment:3</guid> <description> <p> Just ran into this as well. Newer ICU will typedef UChar as char16_t, which then means UChar is no longer hashable by Boost. Please fix... </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 31 May 2017 21:59:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11145#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11145#comment:4</guid> <description> <p> I just added an implementation to the develop branch, </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Mon, 09 Oct 2017 17:27:12 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11145#comment:5 https://svn.boost.org/trac10/ticket/11145#comment:5 <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> Ticket