<?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: Strongly typed constructors	</title>
	<atom:link href="https://www.fluentcpp.com/2016/12/05/named-constructors/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2016/12/05/named-constructors/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Tue, 08 Aug 2017 20:11:53 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.3</generator>
	<item>
		<title>
		By: Tomáš Vávra		</title>
		<link>https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-372</link>

		<dc:creator><![CDATA[Tomáš Vávra]]></dc:creator>
		<pubDate>Sat, 01 Jul 2017 16:51:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=101#comment-372</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-350&quot;&gt;Commander Pirx&lt;/a&gt;.

This is a very restricting solution. If the only difference is in constructor, then it is not so good idea to have 2 different types representing same thing. For example std::vector - you cannot store a CircleFromRadius or CircleFromDiameter]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-350">Commander Pirx</a>.</p>
<p>This is a very restricting solution. If the only difference is in constructor, then it is not so good idea to have 2 different types representing same thing. For example std::vector &#8211; you cannot store a CircleFromRadius or CircleFromDiameter</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Commander Pirx		</title>
		<link>https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-350</link>

		<dc:creator><![CDATA[Commander Pirx]]></dc:creator>
		<pubDate>Fri, 23 Jun 2017 09:40:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=101#comment-350</guid>

					<description><![CDATA[I usually derive different classes. For example CircleFromRadius(double) and CircleFromDiameter(double).]]></description>
			<content:encoded><![CDATA[<p>I usually derive different classes. For example CircleFromRadius(double) and CircleFromDiameter(double).</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-259</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Wed, 10 May 2017 16:55:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=101#comment-259</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-258&quot;&gt;Łukasz Maciejewski&lt;/a&gt;.

Good point Łukasz, I changed the title to be more accurate. It&#039;s cool that you&#039;re learning things. Me too in fact! And if there is something in particular you&#039;re curious about, just let me know.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-258">Łukasz Maciejewski</a>.</p>
<p>Good point Łukasz, I changed the title to be more accurate. It&#8217;s cool that you&#8217;re learning things. Me too in fact! And if there is something in particular you&#8217;re curious about, just let me know.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Łukasz Maciejewski		</title>
		<link>https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-258</link>

		<dc:creator><![CDATA[Łukasz Maciejewski]]></dc:creator>
		<pubDate>Tue, 09 May 2017 18:42:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=101#comment-258</guid>

					<description><![CDATA[I really like the principle behind the solutuib you present here, but the post itself seems to be misnamed. As far as I know, &quot;named constructors&quot; has a specific meaning and means a static method in class, returning an instance of such class by value - https://isocpp.org/wiki/faq/ctors#named-ctor-idiom . The solution here seems to be a variation on the strong typing theme. This thing aside, I really like the blog and often learn something interesting here, so thanks. :-)]]></description>
			<content:encoded><![CDATA[<p>I really like the principle behind the solutuib you present here, but the post itself seems to be misnamed. As far as I know, &#8220;named constructors&#8221; has a specific meaning and means a static method in class, returning an instance of such class by value &#8211; <a href="https://isocpp.org/wiki/faq/ctors#named-ctor-idiom" rel="nofollow ugc">https://isocpp.org/wiki/faq/ctors#named-ctor-idiom</a> . The solution here seems to be a variation on the strong typing theme. This thing aside, I really like the blog and often learn something interesting here, so thanks. 🙂</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-50</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Mon, 09 Jan 2017 22:22:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=101#comment-50</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-49&quot;&gt;Furkan Üzümcü&lt;/a&gt;.

Right, sorry didn&#039;t realize you were referring to IDE real time doc. I get your point then, fair enough.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-49">Furkan Üzümcü</a>.</p>
<p>Right, sorry didn&#8217;t realize you were referring to IDE real time doc. I get your point then, fair enough.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Furkan Üzümcü		</title>
		<link>https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-49</link>

		<dc:creator><![CDATA[Furkan Üzümcü]]></dc:creator>
		<pubDate>Mon, 09 Jan 2017 19:38:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=101#comment-49</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-47&quot;&gt;Jonathan Boccara&lt;/a&gt;.

Don&#039;t get me wrong, I&#039;m just trying to understand the motivation better.
Most IDEs show the additional information about a function so relying on the IDE to know the type is an option.
I think we can also use &lt;code&gt;using Diameter = double;&lt;/code&gt; and &lt;code&gt;using Radius = double;&lt;/code&gt; to maybe visually indicate it if the variable names are not enough.
Maybe I&#039;m just narrowing the situation to just this example and that&#039;s blinding me from seeing the big picture.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-47">Jonathan Boccara</a>.</p>
<p>Don&#8217;t get me wrong, I&#8217;m just trying to understand the motivation better.<br />
Most IDEs show the additional information about a function so relying on the IDE to know the type is an option.<br />
I think we can also use <code>using Diameter = double;</code> and <code>using Radius = double;</code> to maybe visually indicate it if the variable names are not enough.<br />
Maybe I&#8217;m just narrowing the situation to just this example and that&#8217;s blinding me from seeing the big picture.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-47</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Sat, 07 Jan 2017 18:42:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=101#comment-47</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-44&quot;&gt;Furkan Üzümcü&lt;/a&gt;.

Hi Furkan,
I get that this relieves the code from accumulating classes, which is good. But how do you know at a call site if the value passed to the circle constructor is a radius or a diameter?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-44">Furkan Üzümcü</a>.</p>
<p>Hi Furkan,<br />
I get that this relieves the code from accumulating classes, which is good. But how do you know at a call site if the value passed to the circle constructor is a radius or a diameter?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Furkan Üzümcü		</title>
		<link>https://www.fluentcpp.com/2016/12/05/named-constructors/#comment-44</link>

		<dc:creator><![CDATA[Furkan Üzümcü]]></dc:creator>
		<pubDate>Sat, 07 Jan 2017 09:38:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=101#comment-44</guid>

					<description><![CDATA[How about this?

&lt;pre&gt;&lt;code&gt;
class Circle(double radius, double diameter = 0)
    : radius_(diameter == 0 ? radius : diameter / 2)
{
}
&lt;/pre&gt;&lt;/code&gt;

This way you don&#039;t have to create 2 more classes to just accept two different values for a single constructor.]]></description>
			<content:encoded><![CDATA[<p>How about this?</p>
<pre><code>
class Circle(double radius, double diameter = 0)
    : radius_(diameter == 0 ? radius : diameter / 2)
{
}
</code></pre>
<p>This way you don't have to create 2 more classes to just accept two different values for a single constructor.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
