<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	
	>
<channel>
	<title>
	Comments on: Strong Templates	</title>
	<atom:link href="https://www.fluentcpp.com/2018/01/09/strong-templates/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2018/01/09/strong-templates/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Mon, 05 Mar 2018 22:56:00 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.3</generator>
	<item>
		<title>
		By: Antoine Morrier		</title>
		<link>https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-845</link>

		<dc:creator><![CDATA[Antoine Morrier]]></dc:creator>
		<pubDate>Mon, 05 Mar 2018 22:56:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2575#comment-845</guid>

					<description><![CDATA[Actually, you could do something like that to improve template reading and others :).

templatestruct type_t{};

template type_t type_c;

template
auto is_pointer(type_t) {return std::is_pointer{};}

// In a function.
auto t = type_c;
if(is_pointer(t)) {

}

You even can declare operator == and do such a thing
static_assert(type_c == type_c);

It is how boost::hana works.]]></description>
			<content:encoded><![CDATA[<p>Actually, you could do something like that to improve template reading and others :).</p>
<p>templatestruct type_t{};</p>
<p>template type_t type_c;</p>
<p>template<br />
auto is_pointer(type_t) {return std::is_pointer{};}</p>
<p>// In a function.<br />
auto t = type_c;<br />
if(is_pointer(t)) {</p>
<p>}</p>
<p>You even can declare operator == and do such a thing<br />
static_assert(type_c == type_c);</p>
<p>It is how boost::hana works.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nico Bako		</title>
		<link>https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-758</link>

		<dc:creator><![CDATA[Nico Bako]]></dc:creator>
		<pubDate>Tue, 16 Jan 2018 14:36:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2575#comment-758</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-757&quot;&gt;Nico Bako&lt;/a&gt;.

Where Base is defined as :

&lt;code&gt;
&lt;PRE&gt;
template&#038;ltclass BaseClass&#038;gt
class Base
{
public:
	template&#038;ltclass DerivedClass&#038;gt
	static bool isBaseOf()
	{
		return std::is_base_of&#038;ltBaseClass, DerivedClass&#038;gt::value;
	}
};
&lt;/PRE&gt;
&lt;/code&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-757">Nico Bako</a>.</p>
<p>Where Base is defined as :</p>
<p><code></p>
<pre>
template&amp;ltclass BaseClass&amp;gt
class Base
{
public:
	template&amp;ltclass DerivedClass&amp;gt
	static bool isBaseOf()
	{
		return std::is_base_of&amp;ltBaseClass, DerivedClass&amp;gt::value;
	}
};
</pre>
<p></code></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nico Bako		</title>
		<link>https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-757</link>

		<dc:creator><![CDATA[Nico Bako]]></dc:creator>
		<pubDate>Tue, 16 Jan 2018 14:33:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2575#comment-757</guid>

					<description><![CDATA[How about a solution as follows:

&lt;code&gt;
&lt;PRE&gt;
Base&#038;ltA&#038;gt::isBaseOf&#038;ltB&#038;gt(); // returns 1
Base&#038;ltB&#038;gt::isBaseOf&#038;ltA&#038;gt(); // returns 0
&lt;/PRE&gt;
&lt;/code&gt;]]></description>
			<content:encoded><![CDATA[<p>How about a solution as follows:</p>
<p><code></p>
<pre>
Base&amp;ltA&amp;gt::isBaseOf&amp;ltB&amp;gt(); // returns 1
Base&amp;ltB&amp;gt::isBaseOf&amp;ltA&amp;gt(); // returns 0
</pre>
<p></code></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nico Bako		</title>
		<link>https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-752</link>

		<dc:creator><![CDATA[Nico Bako]]></dc:creator>
		<pubDate>Sun, 14 Jan 2018 21:30:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2575#comment-752</guid>

					<description><![CDATA[Hi guys. I think I have a pretty cool solution to the above mentioned article. In my opinion, one of the major flaws in the function std::is_base_of(Base, Derived) is that the function takes two arguments, and the order of the arguments is crucial. Also, li Let me know what you think.

Also, it appears some text formatting is occurring, and some extra symbols are being added to my code... My code compiles, so if you see something that looks like it won&#039;t compile know that I didn&#039;t type that. Does anyone know how to prevent that?

&lt;code&gt;
// Main.cpp
#include 
#include 

template
class Base
{
public:
	template
	bool isBaseOf()
	{
		return std::is_base_of::value;
	}

private:
};

class A
{
	// ...
};

class B : public A
{
	// ...
};

int main()
{
	Base&lt;A&gt; baseA;
	std::cout &#060;&#060; &#034;Is A base of B : &#034; &#060;&#060; baseA.isBaseOf&lt;B&gt;() &#060;&#060; std::endl;
	// prints 1

	Base&lt;B&gt; baseB;
	std::cout &#060;&#060; &#034;Is B base of A : &#034; &#060;&#060; baseB.isBaseOf&lt;A&gt;() &#060;&#060; std::endl;
	// prints 0;

	std::cin.get();
	return 0;
}
&lt;/code&gt;]]></description>
			<content:encoded><![CDATA[<p>Hi guys. I think I have a pretty cool solution to the above mentioned article. In my opinion, one of the major flaws in the function std::is_base_of(Base, Derived) is that the function takes two arguments, and the order of the arguments is crucial. Also, li Let me know what you think.</p>
<p>Also, it appears some text formatting is occurring, and some extra symbols are being added to my code&#8230; My code compiles, so if you see something that looks like it won&#8217;t compile know that I didn&#8217;t type that. Does anyone know how to prevent that?</p>
<p><code><br />
// Main.cpp<br />
#include<br />
#include </p>
<p>template<br />
class Base<br />
{<br />
public:<br />
	template<br />
	bool isBaseOf()<br />
	{<br />
		return std::is_base_of::value;<br />
	}</p>
<p>private:<br />
};</p>
<p>class A<br />
{<br />
	// ...<br />
};</p>
<p>class B : public A<br />
{<br />
	// ...<br />
};</p>
<p>int main()<br />
{<br />
	Base<a> baseA;<br />
	std::cout &lt;&lt; &quot;Is A base of B : &quot; &lt;&lt; baseA.isBaseOf<b>() &lt;&lt; std::endl;<br />
	// prints 1</p>
<p>	Base</b><b> baseB;<br />
	std::cout &lt;&lt; &quot;Is B base of A : &quot; &lt;&lt; baseB.isBaseOf<a>() &lt;&lt; std::endl;<br />
	// prints 0;</p>
<p>	std::cin.get();<br />
	return 0;<br />
}<br />
</a></b></a></code></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Björn Fahller		</title>
		<link>https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-747</link>

		<dc:creator><![CDATA[Björn Fahller]]></dc:creator>
		<pubDate>Wed, 10 Jan 2018 07:53:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2575#comment-747</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-745&quot;&gt;Seph De Busser&lt;/a&gt;.

This is true. It does, which is a disadvantage. The advantage is that it removes the ambiguity of parameter order.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-745">Seph De Busser</a>.</p>
<p>This is true. It does, which is a disadvantage. The advantage is that it removes the ambiguity of parameter order.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Seph De Busser		</title>
		<link>https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-746</link>

		<dc:creator><![CDATA[Seph De Busser]]></dc:creator>
		<pubDate>Tue, 09 Jan 2018 22:46:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2575#comment-746</guid>

					<description><![CDATA[I like this idea a lot, actually. This might also enable to do checking of the types to get compile-time errors clearer and sooner. A poor man&#039;s concepts implementation, if you will. I&#039;ll have to experiment with this a bit later.]]></description>
			<content:encoded><![CDATA[<p>I like this idea a lot, actually. This might also enable to do checking of the types to get compile-time errors clearer and sooner. A poor man&#8217;s concepts implementation, if you will. I&#8217;ll have to experiment with this a bit later.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Seph De Busser		</title>
		<link>https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-745</link>

		<dc:creator><![CDATA[Seph De Busser]]></dc:creator>
		<pubDate>Tue, 09 Jan 2018 22:38:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2575#comment-745</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-741&quot;&gt;Björn Fahller&lt;/a&gt;.

Breaking them up like that requires you to use the template keyword, does it not?
ie: type_traits&lt;A&gt;::template has_base&lt;B&gt;. I would see that as a major disadvantage because of the added boilerplate on the usage side.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-741">Björn Fahller</a>.</p>
<p>Breaking them up like that requires you to use the template keyword, does it not?<br />
ie: type_traits<a>::template has_base<b>. I would see that as a major disadvantage because of the added boilerplate on the usage side.</b></a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-744</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Tue, 09 Jan 2018 21:42:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2575#comment-744</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-741&quot;&gt;Björn Fahller&lt;/a&gt;.

Nice. Thanks for sharing this Björn.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-741">Björn Fahller</a>.</p>
<p>Nice. Thanks for sharing this Björn.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Björn Fahller		</title>
		<link>https://www.fluentcpp.com/2018/01/09/strong-templates/#comment-741</link>

		<dc:creator><![CDATA[Björn Fahller]]></dc:creator>
		<pubDate>Tue, 09 Jan 2018 08:58:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2575#comment-741</guid>

					<description><![CDATA[I think many binary predicate templates become clearer by breaking them up, as is_base&#060;A&#062;::of&#060;B&#062;. The disadvantage is that now you have to come up with two names, one of which will be extremely generic.

One could instead imagine scoping them all into a large type_traits-template: type_traits&#060;A&#062;::has_base&#060;B&#062;,type_traits&#060;A&#062;::is_final, type_traits&#060;A&#062;::is_same_as&#060;B&#062;, etc.]]></description>
			<content:encoded><![CDATA[<p>I think many binary predicate templates become clearer by breaking them up, as is_base&lt;A&gt;::of&lt;B&gt;. The disadvantage is that now you have to come up with two names, one of which will be extremely generic.</p>
<p>One could instead imagine scoping them all into a large type_traits-template: type_traits&lt;A&gt;::has_base&lt;B&gt;,type_traits&lt;A&gt;::is_final, type_traits&lt;A&gt;::is_same_as&lt;B&gt;, etc.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
