<?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 Return a Smart Pointer AND Use Covariance	</title>
	<atom:link href="https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Fri, 06 Jul 2018 08:22: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: Theo		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-1097</link>

		<dc:creator><![CDATA[Theo]]></dc:creator>
		<pubDate>Fri, 06 Jul 2018 08:22:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-1097</guid>

					<description><![CDATA[There are 3 errors in the code of the first CRTP example:

In the first box of &quot;simpe hierarchy v2&quot; the line 
class clone_inherit : public Base
should be
class clone_inherit : public Base
without the template parameters. The way it&#039;s written here is a syntax error.

In the same box, the body of clone_inherit is written as:
return new Derived(*this);
this should be
return new Derived(static_cast(*this));

Otherwise you get the C2662 error (couldn&#039;t convert clone_inherit to concrete). This conversion is exactly what the static_cast achieves. I found this out by comparing the code to the &quot;full&quot; code on the bottom of the article.

And in the main function (3rd box), the line
std::unique_ptr cc = b-&#062;clone();
should be 
std::unique_ptr cc = c-&#062;clone();]]></description>
			<content:encoded><![CDATA[<p>There are 3 errors in the code of the first CRTP example:</p>
<p>In the first box of &#8220;simpe hierarchy v2&#8221; the line<br />
class clone_inherit : public Base<br />
should be<br />
class clone_inherit : public Base<br />
without the template parameters. The way it&#8217;s written here is a syntax error.</p>
<p>In the same box, the body of clone_inherit is written as:<br />
return new Derived(*this);<br />
this should be<br />
return new Derived(static_cast(*this));</p>
<p>Otherwise you get the C2662 error (couldn&#8217;t convert clone_inherit to concrete). This conversion is exactly what the static_cast achieves. I found this out by comparing the code to the &#8220;full&#8221; code on the bottom of the article.</p>
<p>And in the main function (3rd box), the line<br />
std::unique_ptr cc = b-&gt;clone();<br />
should be<br />
std::unique_ptr cc = c-&gt;clone();</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: paercebal		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-548</link>

		<dc:creator><![CDATA[paercebal]]></dc:creator>
		<pubDate>Sat, 16 Sep 2017 23:22:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-548</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-547&quot;&gt;Derp-It Dervacor&lt;/a&gt;.

Hi Derp-it,

If I understood directly, you have a hierarchy composed of( for example):

Component -&#062; Drawable -&#062; Sprite

... where Component is abstract (and thus, you expect the clone_impl method to pure virtual) and both Drawable and Sprite are concrete (and thus, you expect clone_impl to be implemented).

My answers are:
1 - It&#039;s possible as is
2 - From a design viewpoint, I humbly advise you to change your hierarchy if it makes sense to you

1 - IT&#039;S POSSIBLE AS IS

The code is already there, all you need is to chose the right parameters. I believe this would suit your needs:

=====================================


class cloneable
   : public clone_inherit&#060;abstract_method&#062;
{
};


 
///////////////////////////////////////////////////////////////////////////////
 
class component
   : public clone_inherit&#060;abstract_method, cloneable&#062;
{
};
 
///////////////////////////////////////////////////////////////////////////////
 
class drawable
   : public clone_inherit
{
};
 
///////////////////////////////////////////////////////////////////////////////
 
class sprite
   : public clone_inherit
{
};
=====================================

(Please note Wordpress actually messes up any code using lesser-than and greater-than operators, so  please ignore the =&quot;&quot; it adds for no reason)

It should work nicely.

(I did not use virtual inheritance because I don&#039;t expect the need, feel free to correct me. Also, I put a base class cloneable, but it is not necessary, you can just make componant not inherit from cloneable, and it should work)

2 - MAKE NON-LEAF CLASSES ABSTRACT

Please note that this is a suggestion unrelated to the article, and even the whole cloneable thing.

It is usually a good design to make sure, in an OO hierarchy, that leaf classes are final (if only in spirit), and that non-leaf classes are abstract (i.e. non-instantiable). The second part will help you avoid class slicing if you happen to use references instead of pointers, or if you happen to dereference your pointers.

So, what I would do with your Hierarchy would be something like, instead of:

Component -&#062; Drawable -&#062; Sprite

... I would have

Component -&#062; AbstractDrawable -&#062; Drawable
and:
Component -&#062; AbstractDrawable -&#062; Sprite

(i.e. Drawable and Sprite are the only concrete classes, and you can&#039;t cast one into another, and both have AbstractDrawable as an abstract parent class, and AbstractDrawable contains all the code for Drawable, Drawable being mostly a shell class)

This will avoid bugs like:

void foo(Drawable &#038; a, Sprite &#038; b)
{
   a = b ; // this compiles, and probably produces garbage
}

This will also enable you the rearrange your hierarchy more easily, should you want to introduce intermediary classes between already existing classes.

But that&#039;s a bit out of topic for this article.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-547">Derp-It Dervacor</a>.</p>
<p>Hi Derp-it,</p>
<p>If I understood directly, you have a hierarchy composed of( for example):</p>
<p>Component -&gt; Drawable -&gt; Sprite</p>
<p>&#8230; where Component is abstract (and thus, you expect the clone_impl method to pure virtual) and both Drawable and Sprite are concrete (and thus, you expect clone_impl to be implemented).</p>
<p>My answers are:<br />
1 &#8211; It&#8217;s possible as is<br />
2 &#8211; From a design viewpoint, I humbly advise you to change your hierarchy if it makes sense to you</p>
<p>1 &#8211; IT&#8217;S POSSIBLE AS IS</p>
<p>The code is already there, all you need is to chose the right parameters. I believe this would suit your needs:</p>
<p>=====================================</p>
<p>class cloneable<br />
   : public clone_inherit&lt;abstract_method&gt;<br />
{<br />
};</p>
<p>///////////////////////////////////////////////////////////////////////////////</p>
<p>class component<br />
   : public clone_inherit&lt;abstract_method, cloneable&gt;<br />
{<br />
};</p>
<p>///////////////////////////////////////////////////////////////////////////////</p>
<p>class drawable<br />
   : public clone_inherit<br />
{<br />
};</p>
<p>///////////////////////////////////////////////////////////////////////////////</p>
<p>class sprite<br />
   : public clone_inherit<br />
{<br />
};<br />
=====================================</p>
<p>(Please note WordPress actually messes up any code using lesser-than and greater-than operators, so  please ignore the =&#8221;&#8221; it adds for no reason)</p>
<p>It should work nicely.</p>
<p>(I did not use virtual inheritance because I don&#8217;t expect the need, feel free to correct me. Also, I put a base class cloneable, but it is not necessary, you can just make componant not inherit from cloneable, and it should work)</p>
<p>2 &#8211; MAKE NON-LEAF CLASSES ABSTRACT</p>
<p>Please note that this is a suggestion unrelated to the article, and even the whole cloneable thing.</p>
<p>It is usually a good design to make sure, in an OO hierarchy, that leaf classes are final (if only in spirit), and that non-leaf classes are abstract (i.e. non-instantiable). The second part will help you avoid class slicing if you happen to use references instead of pointers, or if you happen to dereference your pointers.</p>
<p>So, what I would do with your Hierarchy would be something like, instead of:</p>
<p>Component -&gt; Drawable -&gt; Sprite</p>
<p>&#8230; I would have</p>
<p>Component -&gt; AbstractDrawable -&gt; Drawable<br />
and:<br />
Component -&gt; AbstractDrawable -&gt; Sprite</p>
<p>(i.e. Drawable and Sprite are the only concrete classes, and you can&#8217;t cast one into another, and both have AbstractDrawable as an abstract parent class, and AbstractDrawable contains all the code for Drawable, Drawable being mostly a shell class)</p>
<p>This will avoid bugs like:</p>
<p>void foo(Drawable &amp; a, Sprite &amp; b)<br />
{<br />
   a = b ; // this compiles, and probably produces garbage<br />
}</p>
<p>This will also enable you the rearrange your hierarchy more easily, should you want to introduce intermediary classes between already existing classes.</p>
<p>But that&#8217;s a bit out of topic for this article.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Derp-It Dervacor		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-547</link>

		<dc:creator><![CDATA[Derp-It Dervacor]]></dc:creator>
		<pubDate>Sat, 16 Sep 2017 00:48:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-547</guid>

					<description><![CDATA[Is there a possible solution for Base -&#062; Concrete -&#062; Concrete (instead of Base -&#062; Abstract -&#062; Concrete)

I ask because of this use case:

I have a scene graph component system. Various components can be attached to nodes to do different things. I have the following classes (I have more, but this is an example)

Component[Abstract] -&#062; Drawable[Concrete]

Here, Drawable adds the draw methods and will render a set of points held internally via opengl with a supplied material as triangles by default. It&#039;s pretty useful, but the interface is very simplistic so not ideal for more complex concepts. As a result I have some specializations of Drawable (also concrete):

Drawable[Concrete] -&#062; Sprite[Concrete] (This is a specialization of Drawable which supports 9-slicing, or common 4 corner sprite commands, and some specializations of texturing simple box shaped meshes.)

___

Hopefully this example shows a situation where it would be nice to be able to use covariant clone methods with smart pointers on middle-nodes. Ideally both Drawable and Sprite would be clone-able.]]></description>
			<content:encoded><![CDATA[<p>Is there a possible solution for Base -&gt; Concrete -&gt; Concrete (instead of Base -&gt; Abstract -&gt; Concrete)</p>
<p>I ask because of this use case:</p>
<p>I have a scene graph component system. Various components can be attached to nodes to do different things. I have the following classes (I have more, but this is an example)</p>
<p>Component[Abstract] -&gt; Drawable[Concrete]</p>
<p>Here, Drawable adds the draw methods and will render a set of points held internally via opengl with a supplied material as triangles by default. It&#8217;s pretty useful, but the interface is very simplistic so not ideal for more complex concepts. As a result I have some specializations of Drawable (also concrete):</p>
<p>Drawable[Concrete] -&gt; Sprite[Concrete] (This is a specialization of Drawable which supports 9-slicing, or common 4 corner sprite commands, and some specializations of texturing simple box shaped meshes.)</p>
<p>___</p>
<p>Hopefully this example shows a situation where it would be nice to be able to use covariant clone methods with smart pointers on middle-nodes. Ideally both Drawable and Sprite would be clone-able.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: paercebal		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-543</link>

		<dc:creator><![CDATA[paercebal]]></dc:creator>
		<pubDate>Tue, 12 Sep 2017 20:32:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-543</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-541&quot;&gt;Nope&lt;/a&gt;.

Hi Nope,

&#062; What do you achieve by adding &quot;using T::T;&quot; ?
&#062; ...
&#062; You also provide link to variadic &quot;using typename ... Bases::Bases;&quot;, but I could not figure out what is going on there.

This is to bring all the constructors from the base classes into the current class. The point was to make sure clone_inherit would interfere as little as possible with the &quot;real&quot; user classes.

Thanks,]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-541">Nope</a>.</p>
<p>Hi Nope,</p>
<p>&gt; What do you achieve by adding &#8220;using T::T;&#8221; ?<br />
&gt; &#8230;<br />
&gt; You also provide link to variadic &#8220;using typename &#8230; Bases::Bases;&#8221;, but I could not figure out what is going on there.</p>
<p>This is to bring all the constructors from the base classes into the current class. The point was to make sure clone_inherit would interfere as little as possible with the &#8220;real&#8221; user classes.</p>
<p>Thanks,</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nope		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-541</link>

		<dc:creator><![CDATA[Nope]]></dc:creator>
		<pubDate>Tue, 12 Sep 2017 16:24:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-541</guid>

					<description><![CDATA[Very nice solution.
What do you achieve by adding &quot;using T::T;&quot; ?
At least GCC is not complaining if omitted.
You also provide link to variadic &quot;using typename ... Bases::Bases;&quot;, but I could not figure out what is going on there.]]></description>
			<content:encoded><![CDATA[<p>Very nice solution.<br />
What do you achieve by adding &#8220;using T::T;&#8221; ?<br />
At least GCC is not complaining if omitted.<br />
You also provide link to variadic &#8220;using typename &#8230; Bases::Bases;&#8221;, but I could not figure out what is going on there.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: paercebal		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-540</link>

		<dc:creator><![CDATA[paercebal]]></dc:creator>
		<pubDate>Tue, 12 Sep 2017 14:26:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-540</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-537&quot;&gt;paercebal&lt;/a&gt;.

Correction done.
:-)
Thanks!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-537">paercebal</a>.</p>
<p>Correction done.<br />
🙂<br />
Thanks!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: paercebal		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-539</link>

		<dc:creator><![CDATA[paercebal]]></dc:creator>
		<pubDate>Tue, 12 Sep 2017 13:26:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-539</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-534&quot;&gt;Quentin Duval&lt;/a&gt;.

Hi Quentin,

Thanks for the comment!
:-)

&#062; Instead of the tag dispatch for the abstract_method, would it make sense to use different class names?

I toyed with a few different ways of specifying if clone_impl had to be pure or not, and in the discussion we had, Jonathan and me, the current one emerged.

For curiosity&#039;s sake, here are the few other candidates:

1 - Using a second parameter in the inheritance:

&#124; class Element : public clone_inherit
&#124; class ComboBox : public clone_inherit

This is arguably ugly, if explicit. It works (it relies on an enum) but, well...

:-/

2 - Using a different name

&#124; class bar : public declare_clone
&#124; class concrete : public implement_clone

While this solution works, I felt it was more complicated because you had two classes, and it is not evident the two actually work together (unless using namespaces, but that&#039;s another problem).

By using a simple name (clone_inherit), my impression is that the reader clearly understands both are the same feature.

3 - Using the same name

This is the solution used for this article:

&#124; class bar : public clone_inherit&#060;abstract_method, etc... &#062;
&#124; class concrete : public clone_inherit

Like I said above, there is no doubt whatsoever that both inheritance rely on the same mechanism, and for me, this is clearly valuable.

The name &quot;abstract_method&quot; could be better, though. It&#039;s always a pain to find a name that isn&#039;t a keyword, but also is short and clear. I can&#039;t remember why I didn&#039;t use &quot;abstract&quot; (this isn&#039;t a C++ keyword, after all).


Another, previous implementation forced the user to tell what they wanted:

&#124; class bar : public clone_inherit&#060;abstract_method, etc... &#062;
&#124; class concrete : public clone_inherit&#060;implemented_method, etc... &#062;

... but there is no real additional value, I believe, as IMHO, the use that happens the more often, and that is the most evident should have less words, the user adding words when they want to move away from the mainstream use. I guess I partially failed that part (I&#039;m open to suggestions/solutions!).


I hope the other parts (showing cool C++ mechanism and providing a solution that asked little or no clutter in the user code) were more successful!
:-)

Thanks!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-534">Quentin Duval</a>.</p>
<p>Hi Quentin,</p>
<p>Thanks for the comment!<br />
🙂</p>
<p>&gt; Instead of the tag dispatch for the abstract_method, would it make sense to use different class names?</p>
<p>I toyed with a few different ways of specifying if clone_impl had to be pure or not, and in the discussion we had, Jonathan and me, the current one emerged.</p>
<p>For curiosity&#8217;s sake, here are the few other candidates:</p>
<p>1 &#8211; Using a second parameter in the inheritance:</p>
<p>| class Element : public clone_inherit<br />
| class ComboBox : public clone_inherit</p>
<p>This is arguably ugly, if explicit. It works (it relies on an enum) but, well&#8230;</p>
<p>:-/</p>
<p>2 &#8211; Using a different name</p>
<p>| class bar : public declare_clone<br />
| class concrete : public implement_clone</p>
<p>While this solution works, I felt it was more complicated because you had two classes, and it is not evident the two actually work together (unless using namespaces, but that&#8217;s another problem).</p>
<p>By using a simple name (clone_inherit), my impression is that the reader clearly understands both are the same feature.</p>
<p>3 &#8211; Using the same name</p>
<p>This is the solution used for this article:</p>
<p>| class bar : public clone_inherit&lt;abstract_method, etc&#8230; &gt;<br />
| class concrete : public clone_inherit</p>
<p>Like I said above, there is no doubt whatsoever that both inheritance rely on the same mechanism, and for me, this is clearly valuable.</p>
<p>The name &#8220;abstract_method&#8221; could be better, though. It&#8217;s always a pain to find a name that isn&#8217;t a keyword, but also is short and clear. I can&#8217;t remember why I didn&#8217;t use &#8220;abstract&#8221; (this isn&#8217;t a C++ keyword, after all).</p>
<p>Another, previous implementation forced the user to tell what they wanted:</p>
<p>| class bar : public clone_inherit&lt;abstract_method, etc&#8230; &gt;<br />
| class concrete : public clone_inherit&lt;implemented_method, etc&#8230; &gt;</p>
<p>&#8230; but there is no real additional value, I believe, as IMHO, the use that happens the more often, and that is the most evident should have less words, the user adding words when they want to move away from the mainstream use. I guess I partially failed that part (I&#8217;m open to suggestions/solutions!).</p>
<p>I hope the other parts (showing cool C++ mechanism and providing a solution that asked little or no clutter in the user code) were more successful!<br />
🙂</p>
<p>Thanks!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: paercebal		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-538</link>

		<dc:creator><![CDATA[paercebal]]></dc:creator>
		<pubDate>Tue, 12 Sep 2017 13:02:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-538</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-535&quot;&gt;Colin Pitrat&lt;/a&gt;.

Hi Colin,

&#062; I&#039;m amazed that in 2017 Visual Studio is still not able to compile valid C++

Indeed, we discovered years ago Visual Studio had a very annoying bug (crash) when mixing virtual inheritance and covariance of the return type on virtual member functions. I&#039;m barely surprised a similar bug (compilation error) appeared for the above code.

This *is* annoying, because it&#039;s a feature that should be considered stable, not &quot;on the edge&quot;.

In the other hand, it is probably barely used, and my perception is that the Visual Studio team is working hard for its compiler to stay relevant in the 21th century, and thus, they have to prioritize. Other compilers are not so lucky.

Thanks,]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-535">Colin Pitrat</a>.</p>
<p>Hi Colin,</p>
<p>&gt; I&#8217;m amazed that in 2017 Visual Studio is still not able to compile valid C++</p>
<p>Indeed, we discovered years ago Visual Studio had a very annoying bug (crash) when mixing virtual inheritance and covariance of the return type on virtual member functions. I&#8217;m barely surprised a similar bug (compilation error) appeared for the above code.</p>
<p>This *is* annoying, because it&#8217;s a feature that should be considered stable, not &#8220;on the edge&#8221;.</p>
<p>In the other hand, it is probably barely used, and my perception is that the Visual Studio team is working hard for its compiler to stay relevant in the 21th century, and thus, they have to prioritize. Other compilers are not so lucky.</p>
<p>Thanks,</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: paercebal		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-537</link>

		<dc:creator><![CDATA[paercebal]]></dc:creator>
		<pubDate>Tue, 12 Sep 2017 12:54:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-537</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-535&quot;&gt;Colin Pitrat&lt;/a&gt;.

Hi Colin,

About the typos...

In fact, when rearranging the article one month ago (*), to give it a more &quot;natural, logical&quot; order, and renaming a few symbols, things got mixed up. Indeed, there are three minor typos:
- Two when the destructor is not named after its class (damn copy-paste errors)
- One when &quot;cloneable&quot; is written &quot;clonable&quot;

Rereading the article, I saw the some virtual destructors actually went away when cleaning the original code from its clutter (comments, alternative name, etc.): In the final source, all versions of clone_inherit should have a default virtual destructor.

All this will be corrected as soon as possible.

Thanks!

(*) Jonathan actually puts a massive amount of work on his blog, and his articles are written well in advance their actual publishing.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-535">Colin Pitrat</a>.</p>
<p>Hi Colin,</p>
<p>About the typos&#8230;</p>
<p>In fact, when rearranging the article one month ago (*), to give it a more &#8220;natural, logical&#8221; order, and renaming a few symbols, things got mixed up. Indeed, there are three minor typos:<br />
&#8211; Two when the destructor is not named after its class (damn copy-paste errors)<br />
&#8211; One when &#8220;cloneable&#8221; is written &#8220;clonable&#8221;</p>
<p>Rereading the article, I saw the some virtual destructors actually went away when cleaning the original code from its clutter (comments, alternative name, etc.): In the final source, all versions of clone_inherit should have a default virtual destructor.</p>
<p>All this will be corrected as soon as possible.</p>
<p>Thanks!</p>
<p>(*) Jonathan actually puts a massive amount of work on his blog, and his articles are written well in advance their actual publishing.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Colin Pitrat		</title>
		<link>https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/#comment-535</link>

		<dc:creator><![CDATA[Colin Pitrat]]></dc:creator>
		<pubDate>Tue, 12 Sep 2017 10:19:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1643#comment-535</guid>

					<description><![CDATA[Nit: There are at least two places where the destructor is incorrect (using another class&#039; name).

Apart from that, I&#039;m amazed that in 2017 Visual Studio is still not able to compile valid C++ ...]]></description>
			<content:encoded><![CDATA[<p>Nit: There are at least two places where the destructor is incorrect (using another class&#8217; name).</p>
<p>Apart from that, I&#8217;m amazed that in 2017 Visual Studio is still not able to compile valid C++ &#8230;</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
