<?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: How to Turn a Hierarchy of Virtual Methods into a CRTP	</title>
	<atom:link href="https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Tue, 20 Nov 2018 07:27:54 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.3</generator>
	<item>
		<title>
		By: Thief		</title>
		<link>https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/#comment-1078</link>

		<dc:creator><![CDATA[Thief]]></dc:creator>
		<pubDate>Fri, 22 Jun 2018 10:44:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2922#comment-1078</guid>

					<description><![CDATA[I would like to share some code of mine that allows for a class that supports CRTP to be used alone or derived from further: https://www.reddit.com/r/cpp/comments/8l8nw1/how_to_turn_a_hierarchy_of_virtual_methods_into_a/dzdr8fh/?context=2

template
class C : B&#060;typename std::conditional&#060;!std::is_same_v, derived, C&#062;::type&#062;;

Essentially if you use C, it will derive C from B&#060;C&#062;, but if you derive from C (e.g. D : C) then C will automatically derive from B instead of B&#060;C&#062;!

You could easily create a helper template which would only take derived and C as parameters and returned derived if non-void and C otherwise to simplify it. Something like:

template
using crtp_derive = std::conditional&#060;!std::is_same_v, derived, class_name&#062;::type;

template
class C : B&#060;crtp_derive&#060;derived, C&#062;&#062;;

maybe?]]></description>
			<content:encoded><![CDATA[<p>I would like to share some code of mine that allows for a class that supports CRTP to be used alone or derived from further: <a href="https://www.reddit.com/r/cpp/comments/8l8nw1/how_to_turn_a_hierarchy_of_virtual_methods_into_a/dzdr8fh/?context=2" rel="nofollow ugc">https://www.reddit.com/r/cpp/comments/8l8nw1/how_to_turn_a_hierarchy_of_virtual_methods_into_a/dzdr8fh/?context=2</a></p>
<p>template<br />
class C : B&lt;typename std::conditional&lt;!std::is_same_v, derived, C&gt;::type&gt;;</p>
<p>Essentially if you use C, it will derive C from B&lt;C&gt;, but if you derive from C (e.g. D : C) then C will automatically derive from B instead of B&lt;C&gt;!</p>
<p>You could easily create a helper template which would only take derived and C as parameters and returned derived if non-void and C otherwise to simplify it. Something like:</p>
<p>template<br />
using crtp_derive = std::conditional&lt;!std::is_same_v, derived, class_name&gt;::type;</p>
<p>template<br />
class C : B&lt;crtp_derive&lt;derived, C&gt;&gt;;</p>
<p>maybe?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: NN		</title>
		<link>https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/#comment-1027</link>

		<dc:creator><![CDATA[NN]]></dc:creator>
		<pubDate>Thu, 31 May 2018 08:51:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2922#comment-1027</guid>

					<description><![CDATA[CRTP and deep inheritance don&#039;t play well if you don&#039;t pass another parameter.
Better way is to do the following:

template
struct CRTP : base_t { // Use derived_t inside }

http://rsdn.org/forum/cpp/2674420.1]]></description>
			<content:encoded><![CDATA[<p>CRTP and deep inheritance don&#8217;t play well if you don&#8217;t pass another parameter.<br />
Better way is to do the following:</p>
<p>template<br />
struct CRTP : base_t { // Use derived_t inside }</p>
<p><a href="http://rsdn.org/forum/cpp/2674420.1" rel="nofollow ugc">http://rsdn.org/forum/cpp/2674420.1</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/#comment-1013</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Fri, 25 May 2018 10:51:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2922#comment-1013</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/#comment-1008&quot;&gt;Simon NIVAULT&lt;/a&gt;.

Absolutely. I have worked your remark into the article, thank you very much Simon.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/#comment-1008">Simon NIVAULT</a>.</p>
<p>Absolutely. I have worked your remark into the article, thank you very much Simon.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Aymen Schehaider		</title>
		<link>https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/#comment-1009</link>

		<dc:creator><![CDATA[Aymen Schehaider]]></dc:creator>
		<pubDate>Tue, 22 May 2018 10:01:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2922#comment-1009</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/#comment-1008&quot;&gt;Simon NIVAULT&lt;/a&gt;.

I may agree with you Simon.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/#comment-1008">Simon NIVAULT</a>.</p>
<p>I may agree with you Simon.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Simon NIVAULT		</title>
		<link>https://www.fluentcpp.com/2018/05/22/how-to-transform-a-hierarchy-of-virtual-methods-into-a-crtp/#comment-1008</link>

		<dc:creator><![CDATA[Simon NIVAULT]]></dc:creator>
		<pubDate>Tue, 22 May 2018 07:37:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=2922#comment-1008</guid>

					<description><![CDATA[Hello Jonathan,

In your last solution, don&#039;t you think we can make B inherit A instead of A&#060;B&#062; ?
If I so, I am not required to define the function helperfunction2 in the B body, and I think this work the same, don&#039;t you ?]]></description>
			<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>In your last solution, don&#8217;t you think we can make B inherit A instead of A&lt;B&gt; ?<br />
If I so, I am not required to define the function helperfunction2 in the B body, and I think this work the same, don&#8217;t you ?</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
