<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Hash Functions for C++ Unordered Containers</title>
	<atom:link href="http://marknelson.us/2011/09/03/hash-functions-for-c-unordered-containers/feed/" rel="self" type="application/rss+xml" />
	<link>http://marknelson.us/2011/09/03/hash-functions-for-c-unordered-containers/</link>
	<description>Programming, mostly.</description>
	<lastBuildDate>Wed, 16 May 2012 08:30:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: tk</title>
		<link>http://marknelson.us/2011/09/03/hash-functions-for-c-unordered-containers/comment-page-1/#comment-491846</link>
		<dc:creator>tk</dc:creator>
		<pubDate>Thu, 08 Mar 2012 22:13:19 +0000</pubDate>
		<guid isPermaLink="false">http://marknelson.us/?p=727#comment-491846</guid>
		<description>Answered my own question - turns out I needed to use namespace tr1 even with -std=c++0x flag defined.</description>
		<content:encoded><![CDATA[<p>Answered my own question &#8211; turns out I needed to use namespace tr1 even with -std=c++0x flag defined.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tk</title>
		<link>http://marknelson.us/2011/09/03/hash-functions-for-c-unordered-containers/comment-page-1/#comment-491844</link>
		<dc:creator>tk</dc:creator>
		<pubDate>Thu, 08 Mar 2012 22:05:10 +0000</pubDate>
		<guid isPermaLink="false">http://marknelson.us/?p=727#comment-491844</guid>
		<description>Hi Mark, first off - great article. Second, a question. In method 4 what happens if I want to call a function outside of the std namespace from inside the std::hash template specialization. For example:
[c]
namespace std {
template class hash
{
    public:
    size_t operator() (const order_id_ptr&amp; x) const {
        size_t hval = CUSTOM_HASH_FUNCTION_IN_GLOBAL_NAMESPACE(x-&gt;oid, UUID_LEN, 0);
        return hval;
    }
};
};

[/c]

This yields tons of non-sensical compiler errors on g++ 4.4.5. Any insight would be hugely appreciated.</description>
		<content:encoded><![CDATA[<p>Hi Mark, first off - great article. Second, a question. In method 4 what happens if I want to call a function outside of the std namespace from inside the std::hash template specialization. For example:</p>
<div class="igBar"><span id="lc-1"><a href="#" onclick="javascript:showPlainTxt('c-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C:</span>
<div id="c-1">
<div class="c">
<ol>
<li class="li1">
<div class="de1">namespace std <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">template class hash</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; public:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; size_t operator<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#40;</span><span class="kw4">const</span> order_id_ptr&amp;amp; x<span class="br0">&#41;</span> <span class="kw4">const</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; size_t hval = CUSTOM_HASH_FUNCTION_IN_GLOBAL_NAMESPACE<span class="br0">&#40;</span>x-&amp;gt;oid, UUID_LEN, <span class="nu0">0</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> hval;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This yields tons of non-sensical compiler errors on g++ 4.4.5. Any insight would be hugely appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Nelson</title>
		<link>http://marknelson.us/2011/09/03/hash-functions-for-c-unordered-containers/comment-page-1/#comment-397082</link>
		<dc:creator>Mark Nelson</dc:creator>
		<pubDate>Mon, 07 Nov 2011 21:15:22 +0000</pubDate>
		<guid isPermaLink="false">http://marknelson.us/?p=727#comment-397082</guid>
		<description>Thanks, be sure to link to it so others can find it!</description>
		<content:encoded><![CDATA[<p>Thanks, be sure to link to it so others can find it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FipS</title>
		<link>http://marknelson.us/2011/09/03/hash-functions-for-c-unordered-containers/comment-page-1/#comment-397080</link>
		<dc:creator>FipS</dc:creator>
		<pubDate>Mon, 07 Nov 2011 21:09:13 +0000</pubDate>
		<guid isPermaLink="false">http://marknelson.us/?p=727#comment-397080</guid>
		<description>Hi Mark, I&#039;ve come across your page when needed to find quick info on how to form a custom hash function. This page is very informative. Thanks for your effort, FipS</description>
		<content:encoded><![CDATA[<p>Hi Mark, I've come across your page when needed to find quick info on how to form a custom hash function. This page is very informative. Thanks for your effort, FipS</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jm</title>
		<link>http://marknelson.us/2011/09/03/hash-functions-for-c-unordered-containers/comment-page-1/#comment-391620</link>
		<dc:creator>jm</dc:creator>
		<pubDate>Sun, 23 Oct 2011 02:46:02 +0000</pubDate>
		<guid isPermaLink="false">http://marknelson.us/?p=727#comment-391620</guid>
		<description>You are right, Mark, I guess I missed the -std=c++0x in your comments.  It should work just fine.  I take my beef back ;) This post is the most thorough treatment of the whole issue I&#039;ve seen online.</description>
		<content:encoded><![CDATA[<p>You are right, Mark, I guess I missed the -std=c++0x in your comments.  It should work just fine.  I take my beef back ;) This post is the most thorough treatment of the whole issue I've seen online.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Nelson</title>
		<link>http://marknelson.us/2011/09/03/hash-functions-for-c-unordered-containers/comment-page-1/#comment-391372</link>
		<dc:creator>Mark Nelson</dc:creator>
		<pubDate>Sat, 22 Oct 2011 13:13:02 +0000</pubDate>
		<guid isPermaLink="false">http://marknelson.us/?p=727#comment-391372</guid>
		<description>@jm:

Thanks jm - I believe, but am not positive, that when g++ is in C++11 mode you don&#039;t use the tr1 namespace. So versions that support the -std=c++0x option will work with my code as is. 

Users with older versions of g++ may find that they have to hoist their function into namespace std::tr1, which is another issue that can very difficult to figure out from just reading compiler errors.

Any definitive correction to that is more than welcome.

- Mark</description>
		<content:encoded><![CDATA[<p>@jm:</p>
<p>Thanks jm - I believe, but am not positive, that when g++ is in C++11 mode you don't use the tr1 namespace. So versions that support the -std=c++0x option will work with my code as is. </p>
<p>Users with older versions of g++ may find that they have to hoist their function into namespace std::tr1, which is another issue that can very difficult to figure out from just reading compiler errors.</p>
<p>Any definitive correction to that is more than welcome.</p>
<p>- Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jm</title>
		<link>http://marknelson.us/2011/09/03/hash-functions-for-c-unordered-containers/comment-page-1/#comment-391206</link>
		<dc:creator>jm</dc:creator>
		<pubDate>Sat, 22 Oct 2011 03:41:54 +0000</pubDate>
		<guid isPermaLink="false">http://marknelson.us/?p=727#comment-391206</guid>
		<description>This is great.  I came here for an example of Method 4 and this was the link (after many others) that finally proved worthwhile.  My only beef is that in g++, I had to use nested namespaces to get it to work.  Like this:
namespace std {
  namespace tr1 {
    /*
     * your very special hash specialization
     */
  }
}</description>
		<content:encoded><![CDATA[<p>This is great.  I came here for an example of Method 4 and this was the link (after many others) that finally proved worthwhile.  My only beef is that in g++, I had to use nested namespaces to get it to work.  Like this:<br />
namespace std {<br />
  namespace tr1 {<br />
    /*<br />
     * your very special hash specialization<br />
     */<br />
  }<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

