<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Whitespace Considered Harmful</title>
	<atom:link href="http://whitespaceconsideredharmful.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://whitespaceconsideredharmful.com</link>
	<description>Previously we had found it convenient to assume reality; henceforth we shall no longer thus constrain ourselves</description>
	<lastBuildDate>Wed, 23 Jun 2010 00:54:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>C++ Template Name Madness</title>
		<link>http://whitespaceconsideredharmful.com/2010/06/c-template-name-madness/</link>
		<comments>http://whitespaceconsideredharmful.com/2010/06/c-template-name-madness/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 00:54:09 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://whitespaceconsideredharmful.com/?p=20</guid>
		<description><![CDATA[As I learned today, name lookups with regards to template based inheritance is a nightmare. I&#8217;ll try to write more later on why this is the case (two phase lookup), but for know lets highlight the situation.
Pretend you have an awesome templated square matrix class, parameterized on the value type and its size. It would [...]]]></description>
			<content:encoded><![CDATA[<p>As I learned today, name lookups with regards to template based inheritance is a nightmare. I&#8217;ll try to write more later on why this is the case (two phase lookup), but for know lets highlight the situation.</p>
<p>Pretend you have an awesome templated square matrix class, parameterized on the value type and its size. It would probably look something like this:</p>
<blockquote><p>// the template class</p></blockquote>
<p>Once you have the matrix, you&#8217;d want to specialize it for specific sizes (say N=4). Its also a good idea to do this so you can add more constructors (doubt you want to keep creating arrays to pass in!). Anyhow, your implementation might end up looking something like</p>
<blockquote><p>// derieved TMatrix4&lt;T&gt;</p></blockquote>
<p>Guess what? It won&#8217;t work! But before we can get to that, the compiler is going to try to confuse us into thinking the problem is somewhere else! Take the following code. It should work, right?</p>
<blockquote><p>TMatrix4&lt;float&gt; a = b + c;</p></blockquote>
<p>Ha! The compiler throws a really nasty error, which I&#8217;ll paraphrase here:</p>
<blockquote><p>&#8220;No match for operator= in &#8216;n=TMatrix&lt;T,N&gt;::operator + ( const TMatrixT,N&gt;&amp; ) const [with T= float, int N=4]&#8220;</p></blockquote>
<p>&#8220;What black magic is this?&#8221;, I hear you say. Without going into details, the compiler is lying to you &#8211; while the compiler is erroring out on the assignment operator it is actually trying to find the constructor. (Return Value Optimization). So, implementing the copy constructor in the derieved TMatrix4 class should solve the problem, right?</p>
<p>Wrong!</p>
<blockquote><p>// i need to recreate the error for you guys</p></blockquote>
<p>When you created TMatrix4, you created a templated class that depended TMatrix&lt;T,N&gt;. When you call operator +, it is using TMatrix&lt;T,N&gt;::+ which has a return type of TMatrix&lt;T,N&gt;. Open returning from operator +, it needs to construct a new object &#8211; but the compiler cannot tell that the returned object is TMatrix4&lt;T&gt;. So the solution:</p>
<blockquote><p>TMatrix4( const TMatrix&lt;T,4&gt;&amp; mat )</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://whitespaceconsideredharmful.com/2010/06/c-template-name-madness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t panic!</title>
		<link>http://whitespaceconsideredharmful.com/2009/10/combatting-spam-in-wordpress-the-easy-way/</link>
		<comments>http://whitespaceconsideredharmful.com/2009/10/combatting-spam-in-wordpress-the-easy-way/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 16:34:58 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://whitespaceconsideredharmful.com//?p=1</guid>
		<description><![CDATA[I just finished upgrading to the newest Wordpress, and guess what! Wordpress ate my weblog entries, and its almost 2:00 in the morning. I&#8217;ll get everything transferred over tomorrow morning.
]]></description>
			<content:encoded><![CDATA[<p>I just finished upgrading to the newest Wordpress, and guess what! Wordpress ate my weblog entries, and its almost 2:00 in the morning. I&#8217;ll get everything transferred over tomorrow morning.</p>
]]></content:encoded>
			<wfw:commentRss>http://whitespaceconsideredharmful.com/2009/10/combatting-spam-in-wordpress-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
