<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[boost::filesystem::path hashen]]></title><description><![CDATA[<p>Hoi,</p>
<p>was ist hier verkehrt?</p>
<pre><code>struct PathHasher
        {
            inline std::size_t operator()(boost::filesystem::path const&amp; path) const noexcept
            {
                return std::hash&lt;decltype(path.string())&gt;()(path.string());
            }
        };
</code></pre>
<p>std::hash meckert immer, dass es dafür nicht spezialisiert ist.<br />
Ersetze ich decltype(...) durch std::string dann funktioniert es.<br />
Habe mit std::removew_const und mit std::remove_reference herumgespielt und es passt immer noch nicht.</p>
<p>Was wäre dire korrekte Lösung?</p>
<p>Danke und Grüße,<br />
Ethon</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/314126/boost-filesystem-path-hashen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 01 Aug 2026 15:50:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/314126.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 21 Feb 2013 13:09:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to boost::filesystem::path hashen on Thu, 21 Feb 2013 13:09:54 GMT]]></title><description><![CDATA[<p>Hoi,</p>
<p>was ist hier verkehrt?</p>
<pre><code>struct PathHasher
        {
            inline std::size_t operator()(boost::filesystem::path const&amp; path) const noexcept
            {
                return std::hash&lt;decltype(path.string())&gt;()(path.string());
            }
        };
</code></pre>
<p>std::hash meckert immer, dass es dafür nicht spezialisiert ist.<br />
Ersetze ich decltype(...) durch std::string dann funktioniert es.<br />
Habe mit std::removew_const und mit std::remove_reference herumgespielt und es passt immer noch nicht.</p>
<p>Was wäre dire korrekte Lösung?</p>
<p>Danke und Grüße,<br />
Ethon</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300609</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Thu, 21 Feb 2013 13:09:54 GMT</pubDate></item><item><title><![CDATA[Reply to boost::filesystem::path hashen on Thu, 21 Feb 2013 13:28:28 GMT]]></title><description><![CDATA[<p>Wenn decltype involviert ist, sollte man sich sowieso angewöhnen immer <code>std::decay&lt;decltype(...)&gt;::type</code> zu verwenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300613</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300613</guid><dc:creator><![CDATA[dekan]]></dc:creator><pubDate>Thu, 21 Feb 2013 13:28:28 GMT</pubDate></item><item><title><![CDATA[Reply to boost::filesystem::path hashen on Thu, 21 Feb 2013 13:33:57 GMT]]></title><description><![CDATA[<p>Ah, jetzt funktioniert's ... danke.<br />
Komisch dass ich mit remove_const und remove_reference string const&amp; nicht zu string bekommen habe ... najo, was solls. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300614</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300614</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Thu, 21 Feb 2013 13:33:57 GMT</pubDate></item><item><title><![CDATA[Reply to boost::filesystem::path hashen on Thu, 21 Feb 2013 15:27:28 GMT]]></title><description><![CDATA[<p>Kleine Nebenfrage: Wo steht im Standard, dass der Ctor oder der Funktionsoperator noexcept sein müssen? Muss bei dir dann das <code>noexcept</code> nicht eher bedingt sein?</p>
<p>Edit:</p>
<p>N3337 §20.8.12/1 schrieb:</p>
<blockquote>
<p>[...] the<br />
instantiation hash&lt;Key&gt; shall: [...] satisfy the requirement that the expression h(k), where h is an object of type hash&lt;Key&gt; and k is an<br />
object of type Key, shall not throw an exception unless hash&lt;Key&gt; is a user-defined specialization that<br />
depends on at least one user-defined type.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2300653</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300653</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Thu, 21 Feb 2013 15:27:28 GMT</pubDate></item><item><title><![CDATA[Reply to boost::filesystem::path hashen on Fri, 22 Feb 2013 09:47:44 GMT]]></title><description><![CDATA[<p>Sone schrieb:</p>
<blockquote>
<p>Kleine Nebenfrage: Wo steht im Standard, dass der Ctor oder der Funktionsoperator noexcept sein müssen? Muss bei dir dann das <code>noexcept</code> nicht eher bedingt sein?</p>
<p>Edit:</p>
<p>N3337 §20.8.12/1 schrieb:</p>
<blockquote>
<p>[...] the<br />
instantiation hash&lt;Key&gt; shall: [...] satisfy the requirement that the expression h(k), where h is an object of type hash&lt;Key&gt; and k is an<br />
object of type Key, shall not throw an exception unless hash&lt;Key&gt; is a user-defined specialization that<br />
depends on at least one user-defined type.</p>
</blockquote>
</blockquote>
<p>Najo, ich hab einfach den Body aus der libstdc++ Implementierung von std::hash rauskopiert und editiert, garnicht darüber nachgedacht.</p>
<p>Aber da sowieso niemals eine Exception beim Hashen von string fliegen könnte ... relativ egal ob's dasteht oder nicht. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2300922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2300922</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Fri, 22 Feb 2013 09:47:44 GMT</pubDate></item></channel></rss>