<?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#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments for cplusplus.co.il</title>
	<atom:link href="http://cplusplus.co.il/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://cplusplus.co.il</link>
	<description>Discussing modern C++ and related topics.</description>
	<lastBuildDate>Tue, 31 Jan 2012 01:36:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>Comment on Reference to temporary by Boris Batkin</title>
		<link>http://cplusplus.co.il/2009/09/20/reference-to-temporary/#comment-739</link>
		<dc:creator><![CDATA[Boris Batkin]]></dc:creator>
		<pubDate>Tue, 31 Jan 2012 01:36:14 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=254#comment-739</guid>
		<description><![CDATA[It&#039;s not virtual dispatching, since its temp object being destructed. And type of that temp object is known at compilation time. Think of it as if it was something in the lines of { B tmp = func(); const &amp; A = tmp; }, only with the move semantics. Otherwise very good article.]]></description>
		<content:encoded><![CDATA[<p>It&#8217;s not virtual dispatching, since its temp object being destructed. And type of that temp object is known at compilation time. Think of it as if it was something in the lines of { B tmp = func(); const &amp; A = tmp; }, only with the move semantics. Otherwise very good article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Imitation of Java Generics by Andrzej Krzemieński</title>
		<link>http://cplusplus.co.il/2010/12/31/imitation-of-java-generics/#comment-708</link>
		<dc:creator><![CDATA[Andrzej Krzemieński]]></dc:creator>
		<pubDate>Fri, 30 Sep 2011 11:50:35 +0000</pubDate>
		<guid isPermaLink="false">http://cplusplus.co.il/?p=1094#comment-708</guid>
		<description><![CDATA[Hi,
I would like to add to your view of generics that apart from problems like clumsy interface (we require unnecessary inheritance) and some safety issues, they have obvious advantages over templates, at least when it comes to defining generic containers:
1. No cryptic error messages.
2. Much faster compilation - a generic can be compiled once, regardless of how many times you instantiate it and with how many types.
3. Smaller executable - each template instantiation generates almost the same code time and again - this is not so for generics

That said, I would also not like to see generics in C++. You can still implement something similar yourself using templates.

Regards,
&amp;rzej]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
I would like to add to your view of generics that apart from problems like clumsy interface (we require unnecessary inheritance) and some safety issues, they have obvious advantages over templates, at least when it comes to defining generic containers:<br />
1. No cryptic error messages.<br />
2. Much faster compilation &#8211; a generic can be compiled once, regardless of how many times you instantiate it and with how many types.<br />
3. Smaller executable &#8211; each template instantiation generates almost the same code time and again &#8211; this is not so for generics</p>
<p>That said, I would also not like to see generics in C++. You can still implement something similar yourself using templates.</p>
<p>Regards,<br />
&amp;rzej</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on boost::optional and its internals by Iain Fraser</title>
		<link>http://cplusplus.co.il/2009/12/04/boost-optional-and-its-internals/#comment-703</link>
		<dc:creator><![CDATA[Iain Fraser]]></dc:creator>
		<pubDate>Wed, 14 Sep 2011 18:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://cplusplus.co.il/?p=623#comment-703</guid>
		<description><![CDATA[great article man]]></description>
		<content:encoded><![CDATA[<p>great article man</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Reference to temporary by Андрей Кузнецов</title>
		<link>http://cplusplus.co.il/2009/09/20/reference-to-temporary/#comment-682</link>
		<dc:creator><![CDATA[Андрей Кузнецов]]></dc:creator>
		<pubDate>Fri, 01 Jul 2011 19:57:24 +0000</pubDate>
		<guid isPermaLink="false">http://cpptalk.wordpress.com/?p=254#comment-682</guid>
		<description><![CDATA[great article! very interesting point about how proper dctor is being called without virtual dispatching. Tnx]]></description>
		<content:encoded><![CDATA[<p>great article! very interesting point about how proper dctor is being called without virtual dispatching. Tnx</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Variadic macro to count number of arguments by Andrea Zilio</title>
		<link>http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of-arguments/#comment-670</link>
		<dc:creator><![CDATA[Andrea Zilio]]></dc:creator>
		<pubDate>Fri, 29 Apr 2011 23:15:48 +0000</pubDate>
		<guid isPermaLink="false">http://cplusplus.co.il/?p=1003#comment-670</guid>
		<description><![CDATA[To support zero arguments:

#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL(, ##__VA_ARGS__, 5,4,3,2,1,0)
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N]]></description>
		<content:encoded><![CDATA[<p>To support zero arguments:</p>
<p>#define VA_NUM_ARGS(&#8230;) VA_NUM_ARGS_IMPL(, ##__VA_ARGS__, 5,4,3,2,1,0)<br />
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,&#8230;) N</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Variadic macro to count number of arguments by Paul Vercellotti</title>
		<link>http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of-arguments/#comment-665</link>
		<dc:creator><![CDATA[Paul Vercellotti]]></dc:creator>
		<pubDate>Fri, 15 Apr 2011 21:44:55 +0000</pubDate>
		<guid isPermaLink="false">http://cplusplus.co.il/?p=1003#comment-665</guid>
		<description><![CDATA[Here is an implementation that works for the zero-arguments case, incorporating Jens Gustedt&#039;s very helpful workaround posted further up in the comments.  It could use some simplification, but it works:




#define _ARG16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) _15
#define HAS_COMMA(...) _ARG16(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
#define HAS_NO_COMMA(...) _ARG16(__VA_ARGS__, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
#define _TRIGGER_PARENTHESIS_(...) ,

#define HAS_ZERO_OR_ONE_ARGS(...)                                                    \
_HAS_ZERO_OR_ONE_ARGS(                                                               \
          /* test if there is just one argument, eventually an empty    \
             one */                                                     \
          HAS_COMMA(__VA_ARGS__),                                       \
          /* test if _TRIGGER_PARENTHESIS_ together with the argument   \
             adds a comma */                                            \
          HAS_COMMA(_TRIGGER_PARENTHESIS_ __VA_ARGS__),                 \
          /* test if the argument together with a parenthesis           \
             adds a comma */                                            \
          HAS_COMMA(__VA_ARGS__ (~)),                                   \
          /* test if placing it between _TRIGGER_PARENTHESIS_ and the   \
             parenthesis adds a comma */                                \
          HAS_COMMA(_TRIGGER_PARENTHESIS_ __VA_ARGS__ (~))              \
          )
 
#define PASTE5(_0, _1, _2, _3, _4) _0 ## _1 ## _2 ## _3 ## _4
#define _HAS_ZERO_OR_ONE_ARGS(_0, _1, _2, _3) HAS_NO_COMMA(PASTE5(_IS_EMPTY_CASE_, _0, _1, _2, _3))
#define _IS_EMPTY_CASE_0001 ,
 

#define _VA0(...) HAS_ZERO_OR_ONE_ARGS(__VA_ARGS__)
#define _VA1(...) HAS_ZERO_OR_ONE_ARGS(__VA_ARGS__)
#define _VA2(...) 2
#define _VA3(...) 3
#define _VA4(...) 4
#define _VA5(...) 5
#define _VA6(...) 6
#define _VA7(...) 7
#define _VA8(...) 8
#define _VA9(...) 9
#define _VA10(...) 10
#define _VA11(...) 11
#define _VA12(...) 12
#define _VA13(...) 13
#define _VA14(...) 14
#define _VA15(...) 15
#define _VA16(...) 16

#define VA_NUM_ARGS(...)  VA_NUM_ARGS_IMPL(__VA_ARGS__, PP_RSEQ_N(__VA_ARGS__) )
#define VA_NUM_ARGS_IMPL(...) VA_NUM_ARGS_N(__VA_ARGS__)

#define VA_NUM_ARGS_N( \
	_1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \
	_11,_12,_13,_14,_15,_16,N,...) N 

#define PP_RSEQ_N(...) \
	_VA16(__VA_ARGS__),_VA15(__VA_ARGS__),_VA14(__VA_ARGS__),_VA13(__VA_ARGS__),\
	_VA12(__VA_ARGS__),_VA11(__VA_ARGS__),_VA10(__VA_ARGS__), _VA9(__VA_ARGS__),\
	_VA8(__VA_ARGS__),_VA7(__VA_ARGS__),_VA6(__VA_ARGS__),_VA5(__VA_ARGS__),\
	_VA4(__VA_ARGS__),_VA3(__VA_ARGS__),_VA2(__VA_ARGS__),_VA1(__VA_ARGS__),\
	_VA0(__VA_ARGS__) 


Enjoy
Paul]]></description>
		<content:encoded><![CDATA[<p>Here is an implementation that works for the zero-arguments case, incorporating Jens Gustedt&#8217;s very helpful workaround posted further up in the comments.  It could use some simplification, but it works:</p>
<p>#define _ARG16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, &#8230;) _15<br />
#define HAS_COMMA(&#8230;) _ARG16(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)<br />
#define HAS_NO_COMMA(&#8230;) _ARG16(__VA_ARGS__, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)<br />
#define _TRIGGER_PARENTHESIS_(&#8230;) ,</p>
<p>#define HAS_ZERO_OR_ONE_ARGS(&#8230;)                                                    \<br />
_HAS_ZERO_OR_ONE_ARGS(                                                               \<br />
          /* test if there is just one argument, eventually an empty    \<br />
             one */                                                     \<br />
          HAS_COMMA(__VA_ARGS__),                                       \<br />
          /* test if _TRIGGER_PARENTHESIS_ together with the argument   \<br />
             adds a comma */                                            \<br />
          HAS_COMMA(_TRIGGER_PARENTHESIS_ __VA_ARGS__),                 \<br />
          /* test if the argument together with a parenthesis           \<br />
             adds a comma */                                            \<br />
          HAS_COMMA(__VA_ARGS__ (~)),                                   \<br />
          /* test if placing it between _TRIGGER_PARENTHESIS_ and the   \<br />
             parenthesis adds a comma */                                \<br />
          HAS_COMMA(_TRIGGER_PARENTHESIS_ __VA_ARGS__ (~))              \<br />
          )</p>
<p>#define PASTE5(_0, _1, _2, _3, _4) _0 ## _1 ## _2 ## _3 ## _4<br />
#define _HAS_ZERO_OR_ONE_ARGS(_0, _1, _2, _3) HAS_NO_COMMA(PASTE5(_IS_EMPTY_CASE_, _0, _1, _2, _3))<br />
#define _IS_EMPTY_CASE_0001 ,</p>
<p>#define _VA0(&#8230;) HAS_ZERO_OR_ONE_ARGS(__VA_ARGS__)<br />
#define _VA1(&#8230;) HAS_ZERO_OR_ONE_ARGS(__VA_ARGS__)<br />
#define _VA2(&#8230;) 2<br />
#define _VA3(&#8230;) 3<br />
#define _VA4(&#8230;) 4<br />
#define _VA5(&#8230;) 5<br />
#define _VA6(&#8230;) 6<br />
#define _VA7(&#8230;) 7<br />
#define _VA8(&#8230;) 8<br />
#define _VA9(&#8230;) 9<br />
#define _VA10(&#8230;) 10<br />
#define _VA11(&#8230;) 11<br />
#define _VA12(&#8230;) 12<br />
#define _VA13(&#8230;) 13<br />
#define _VA14(&#8230;) 14<br />
#define _VA15(&#8230;) 15<br />
#define _VA16(&#8230;) 16</p>
<p>#define VA_NUM_ARGS(&#8230;)  VA_NUM_ARGS_IMPL(__VA_ARGS__, PP_RSEQ_N(__VA_ARGS__) )<br />
#define VA_NUM_ARGS_IMPL(&#8230;) VA_NUM_ARGS_N(__VA_ARGS__)</p>
<p>#define VA_NUM_ARGS_N( \<br />
	_1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \<br />
	_11,_12,_13,_14,_15,_16,N,&#8230;) N </p>
<p>#define PP_RSEQ_N(&#8230;) \<br />
	_VA16(__VA_ARGS__),_VA15(__VA_ARGS__),_VA14(__VA_ARGS__),_VA13(__VA_ARGS__),\<br />
	_VA12(__VA_ARGS__),_VA11(__VA_ARGS__),_VA10(__VA_ARGS__), _VA9(__VA_ARGS__),\<br />
	_VA8(__VA_ARGS__),_VA7(__VA_ARGS__),_VA6(__VA_ARGS__),_VA5(__VA_ARGS__),\<br />
	_VA4(__VA_ARGS__),_VA3(__VA_ARGS__),_VA2(__VA_ARGS__),_VA1(__VA_ARGS__),\<br />
	_VA0(__VA_ARGS__) </p>
<p>Enjoy<br />
Paul</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Variadic macro to count number of arguments by Stan</title>
		<link>http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of-arguments/#comment-644</link>
		<dc:creator><![CDATA[Stan]]></dc:creator>
		<pubDate>Wed, 23 Feb 2011 13:36:14 +0000</pubDate>
		<guid isPermaLink="false">http://cplusplus.co.il/?p=1003#comment-644</guid>
		<description><![CDATA[Hi,

thanks for this interesting post.

However, the following code (as stated above) doesn&#039;t work as expected in Visual Studio (I have tested on VS2010):

#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL(__VA_ARGS__, 5,4,3,2,1)
#define VA_NUM_ARGS_IMPL(_1,_2,_3,_4,_5,N,...) N

// to verify, run the preprocessor alone (g++ -E):
VA_NUM_ARGS(x,y,z)


VS appears to have a bug regarding the __VA_ARGS__ expansion.

Here is a workaround, hope it will help those who struggle with it in VS as I did:

#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((__VA_ARGS__, 5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_1,_2,_3,_4,_5,N,...) N

Best regards,
Stan.]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>thanks for this interesting post.</p>
<p>However, the following code (as stated above) doesn&#8217;t work as expected in Visual Studio (I have tested on VS2010):</p>
<p>#define VA_NUM_ARGS(&#8230;) VA_NUM_ARGS_IMPL(__VA_ARGS__, 5,4,3,2,1)<br />
#define VA_NUM_ARGS_IMPL(_1,_2,_3,_4,_5,N,&#8230;) N</p>
<p>// to verify, run the preprocessor alone (g++ -E):<br />
VA_NUM_ARGS(x,y,z)</p>
<p>VS appears to have a bug regarding the __VA_ARGS__ expansion.</p>
<p>Here is a workaround, hope it will help those who struggle with it in VS as I did:</p>
<p>#define VA_NUM_ARGS(&#8230;) VA_NUM_ARGS_IMPL_((__VA_ARGS__, 5,4,3,2,1))<br />
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple<br />
#define VA_NUM_ARGS_IMPL(_1,_2,_3,_4,_5,N,&#8230;) N</p>
<p>Best regards,<br />
Stan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Imitation of Java Generics by No</title>
		<link>http://cplusplus.co.il/2010/12/31/imitation-of-java-generics/#comment-635</link>
		<dc:creator><![CDATA[No]]></dc:creator>
		<pubDate>Wed, 09 Feb 2011 02:20:56 +0000</pubDate>
		<guid isPermaLink="false">http://cplusplus.co.il/?p=1094#comment-635</guid>
		<description><![CDATA[And this is why C++ programmers laugh when Java programmers talk about object models and what could be stripped away without loss.]]></description>
		<content:encoded><![CDATA[<p>And this is why C++ programmers laugh when Java programmers talk about object models and what could be stripped away without loss.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Imitation of Java Generics by NN</title>
		<link>http://cplusplus.co.il/2010/12/31/imitation-of-java-generics/#comment-634</link>
		<dc:creator><![CDATA[NN]]></dc:creator>
		<pubDate>Tue, 08 Feb 2011 12:57:25 +0000</pubDate>
		<guid isPermaLink="false">http://cplusplus.co.il/?p=1094#comment-634</guid>
		<description><![CDATA[Your example is rewritten in C++ using static interface.
Like it is done in std:: classes .

template &lt;typename T, typename Compare = std::less &gt;
class priority_queue;

I don&#039;t remember myself needing this type check so often.

Since C++ doesn&#039;t have a standard interfaces like Comparable, in most cases you rely on compile-time interface.]]></description>
		<content:encoded><![CDATA[<p>Your example is rewritten in C++ using static interface.<br />
Like it is done in std:: classes .</p>
<p>template &lt;typename T, typename Compare = std::less &gt;<br />
class priority_queue;</p>
<p>I don&#8217;t remember myself needing this type check so often.</p>
<p>Since C++ doesn&#8217;t have a standard interfaces like Comparable, in most cases you rely on compile-time interface.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Imitation of Java Generics by Motti Lanzkron</title>
		<link>http://cplusplus.co.il/2010/12/31/imitation-of-java-generics/#comment-633</link>
		<dc:creator><![CDATA[Motti Lanzkron]]></dc:creator>
		<pubDate>Mon, 07 Feb 2011 19:29:13 +0000</pubDate>
		<guid isPermaLink="false">http://cplusplus.co.il/?p=1094#comment-633</guid>
		<description><![CDATA[As Zara said, you seem to be underestimating concepts. Concepts were supposed to be non-intrusive, you wouldn&#039;t have to derive your class from Comparable it would be deduced automatically from the concept.
&lt;pre&gt;
auto concept Comparable&lt;typename T&gt; {
    bool operator&lt;(const T&amp;, const T&amp;);
};
&lt;/pre&gt;
And you could also adapt types to meet the static interface.

&lt;pre&gt;
concept_map Comparable {
   bool operator&lt;(const SomeType&amp; lhs, const SomeType&amp;rhs) { 
      return lhs.IsLessThan(rhs);
  }
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>As Zara said, you seem to be underestimating concepts. Concepts were supposed to be non-intrusive, you wouldn&#8217;t have to derive your class from Comparable it would be deduced automatically from the concept.</p>
<pre>
auto concept Comparable&lt;typename T&gt; {
    bool operator&lt;(const T&amp;, const T&amp;);
};
</pre>
<p>And you could also adapt types to meet the static interface.</p>
<pre>
concept_map Comparable {
   bool operator&lt;(const SomeType&amp; lhs, const SomeType&amp;rhs) {
      return lhs.IsLessThan(rhs);
  }
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

