<?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: Passing strong types by reference	</title>
	<atom:link href="https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Tue, 12 Sep 2017 11:16: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: Dinesh Khandelwal		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-536</link>

		<dc:creator><![CDATA[Dinesh Khandelwal]]></dc:creator>
		<pubDate>Tue, 12 Sep 2017 11:16:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-536</guid>

					<description><![CDATA[If I&#039;m not wrong, we can also use a perfect forwarding constructor rather than having two different constructors. It would work with references too without any need of SFINAE.]]></description>
			<content:encoded><![CDATA[<p>If I&#8217;m not wrong, we can also use a perfect forwarding constructor rather than having two different constructors. It would work with references too without any need of SFINAE.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Rs		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-295</link>

		<dc:creator><![CDATA[Rs]]></dc:creator>
		<pubDate>Tue, 23 May 2017 18:06:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-295</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-194&quot;&gt;Peter Nimmo&lt;/a&gt;.

This is a late answer and so VS2017 have changed since your comment. 
With the latest VS2017 update though: 
&lt;pre&gt;&lt;code&gt;
std::is_reference{} 
&lt;/pre&gt;&lt;/code&gt;
seem indeed not to be working; however, using:
&lt;/pre&gt;&lt;/code&gt;
 std::is_reference::value 
// or even 
std::is_reference_v
&lt;/pre&gt;&lt;/code&gt;
 works.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-194">Peter Nimmo</a>.</p>
<p>This is a late answer and so VS2017 have changed since your comment.<br />
With the latest VS2017 update though: </p>
<pre><code>
std::is_reference{} 
</code></pre>
<p>seem indeed not to be working; however, using:</p>
<p> std::is_reference::value<br />
// or even<br />
std::is_reference_v</p>
<p> works.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-279</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Wed, 17 May 2017 11:50:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-279</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-278&quot;&gt;Denis Navarro&lt;/a&gt;.

You&#039;re right Puneet and Denis. I was mistaken by thinking that U&#038; and U const&#038; couldn&#039;t be two overloads. I amended the sentence in the post following your remarks. Thanks a lot guys for being so accurate in your reading, and for making me learn these things!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-278">Denis Navarro</a>.</p>
<p>You&#8217;re right Puneet and Denis. I was mistaken by thinking that U&amp; and U const&amp; couldn&#8217;t be two overloads. I amended the sentence in the post following your remarks. Thanks a lot guys for being so accurate in your reading, and for making me learn these things!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Denis Navarro		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-278</link>

		<dc:creator><![CDATA[Denis Navarro]]></dc:creator>
		<pubDate>Tue, 16 May 2017 17:27:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-278</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-177&quot;&gt;Puneet Agrawal&lt;/a&gt;.

Hello everyone.

Puneet is right. This statement is not true.

&quot;T const&#038;&quot; becomes &quot;U&#038; const&#038;&quot; which collapses into &quot;U&#038;&quot;, not 
&quot;U const&#038;&quot;. Since &quot;T&#038;&#038;&quot; becomes &quot;U&#038; &#038;&#038;&quot; which collapses into &quot;U&#038;&quot; too, there is an ambiguity.

From N4659 (2017-03-21) §11.3.2:
If a typedef-name (10.1.3, 17.1) or a decltype-specifier (10.1.7.2) denotes a type TR that is a reference to a type T, an attempt to create the type “lvalue reference to cv TR” creates the type “lvalue reference to T”, while an attempt to create the type “rvalue reference to cv TR” creates the type TR. [ Note: This rule is known as reference collapsing. —end note ]

The code below compiles with GCC:
#include 
template
    void test(RefToInteger const&#038; param) {
                    param = 0;
    }
    int main()
    {
                    int i = 5;
                    test(i); // &quot;RefToInteger const&#038;&quot; becomes &quot;int&#038;&quot;.
            std::cout &#060;&#060; i; // prints 0
                    return 0;
    }]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-177">Puneet Agrawal</a>.</p>
<p>Hello everyone.</p>
<p>Puneet is right. This statement is not true.</p>
<p>&#8220;T const&amp;&#8221; becomes &#8220;U&amp; const&amp;&#8221; which collapses into &#8220;U&amp;&#8221;, not<br />
&#8220;U const&amp;&#8221;. Since &#8220;T&amp;&amp;&#8221; becomes &#8220;U&amp; &amp;&amp;&#8221; which collapses into &#8220;U&amp;&#8221; too, there is an ambiguity.</p>
<p>From N4659 (2017-03-21) §11.3.2:<br />
If a typedef-name (10.1.3, 17.1) or a decltype-specifier (10.1.7.2) denotes a type TR that is a reference to a type T, an attempt to create the type “lvalue reference to cv TR” creates the type “lvalue reference to T”, while an attempt to create the type “rvalue reference to cv TR” creates the type TR. [ Note: This rule is known as reference collapsing. —end note ]</p>
<p>The code below compiles with GCC:<br />
#include<br />
template<br />
    void test(RefToInteger const&amp; param) {<br />
                    param = 0;<br />
    }<br />
    int main()<br />
    {<br />
                    int i = 5;<br />
                    test(i); // &#8220;RefToInteger const&amp;&#8221; becomes &#8220;int&amp;&#8221;.<br />
            std::cout &lt;&lt; i; // prints 0<br />
                    return 0;<br />
    }</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-196</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Sun, 09 Apr 2017 15:40:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-196</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-194&quot;&gt;Peter Nimmo&lt;/a&gt;.

Thanks Peter for bringing up this issue. I&#039;ll get back to you as soon as I have an answer for this.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-194">Peter Nimmo</a>.</p>
<p>Thanks Peter for bringing up this issue. I&#8217;ll get back to you as soon as I have an answer for this.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Peter Nimmo		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-194</link>

		<dc:creator><![CDATA[Peter Nimmo]]></dc:creator>
		<pubDate>Fri, 07 Apr 2017 11:48:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-194</guid>

					<description><![CDATA[Is there any way to get this to work with VS2017?  Even with the latest update it complains about not having a default constructor for std::is_reference{}]]></description>
			<content:encoded><![CDATA[<p>Is there any way to get this to work with VS2017?  Even with the latest update it complains about not having a default constructor for std::is_reference{}</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Puneet Agrawal		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-178</link>

		<dc:creator><![CDATA[Puneet Agrawal]]></dc:creator>
		<pubDate>Thu, 16 Mar 2017 11:35:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-178</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-177&quot;&gt;Puneet Agrawal&lt;/a&gt;.

Well, in this case because of refernce collpasing rules, const is also being dropped, that is why we are getting the ambiguity. Sorry, I found it a little confusing]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-177">Puneet Agrawal</a>.</p>
<p>Well, in this case because of refernce collpasing rules, const is also being dropped, that is why we are getting the ambiguity. Sorry, I found it a little confusing</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Puneet Agrawal		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-177</link>

		<dc:creator><![CDATA[Puneet Agrawal]]></dc:creator>
		<pubDate>Thu, 16 Mar 2017 10:15:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-177</guid>

					<description><![CDATA[&quot;Anyway, the bottom line is that the two resulting constructors take a U const&#038; and a U&#038; respectively, which is ambiguous, and the code won’t compile.&quot;
I dont&#039; think this statement is true. In which case should this be ambiguous?]]></description>
			<content:encoded><![CDATA[<p>&#8220;Anyway, the bottom line is that the two resulting constructors take a U const&amp; and a U&amp; respectively, which is ambiguous, and the code won’t compile.&#8221;<br />
I dont&#8217; think this statement is true. In which case should this be ambiguous?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Puneet Agrawal		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-175</link>

		<dc:creator><![CDATA[Puneet Agrawal]]></dc:creator>
		<pubDate>Thu, 16 Mar 2017 10:04:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-175</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-142&quot;&gt;Jonathan Boccara&lt;/a&gt;.

yes, still keep T as a data member, and only update move constructor as :
explicit Namedtype(decay_t&#038;&#038; value) ;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-142">Jonathan Boccara</a>.</p>
<p>yes, still keep T as a data member, and only update move constructor as :<br />
explicit Namedtype(decay_t&amp;&amp; value) ;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Martin Dowie		</title>
		<link>https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-144</link>

		<dc:creator><![CDATA[Martin Dowie]]></dc:creator>
		<pubDate>Wed, 08 Mar 2017 20:45:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=784#comment-144</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-142&quot;&gt;Jonathan Boccara&lt;/a&gt;.

I think you would have a &quot;std::decay::type value_;&quot;...]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/03/06/passing-strong-types-reference-revisited/#comment-142">Jonathan Boccara</a>.</p>
<p>I think you would have a &#8220;std::decay::type value_;&#8221;&#8230;</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
