<?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: Super expressive code by Raising Levels of Abstraction	</title>
	<atom:link href="https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Thu, 08 Nov 2018 12:46: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: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-1450</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Thu, 08 Nov 2018 12:46:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=290#comment-1450</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-37&quot;&gt;Jonathan Boccara&lt;/a&gt;.

Ok I see. But can you have a (anonymous or not) namespace inside of a function?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-37">Jonathan Boccara</a>.</p>
<p>Ok I see. But can you have a (anonymous or not) namespace inside of a function?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Shreyans		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-1449</link>

		<dc:creator><![CDATA[Shreyans]]></dc:creator>
		<pubDate>Thu, 08 Nov 2018 12:35:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=290#comment-1449</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-1446&quot;&gt;Jonathan Boccara&lt;/a&gt;.

Having a constant in anonymous namespace also means we&#039;ll allocate it only once. And one of the major disadvantage of having static variable is the thread safety provided by the standard &#038; compiler. So, even though the data is const, compiler generates locks before that for thread safety. Although this happens mostly with the objects which requires dynamic allocation(like std::string). For rest, (like int), compiler optimisations do their job properly.
On that other hand, if its in anonymous namespace, it might be directly substituted by compiler optimisation based on flag as well and no thread locking related code is generated. And also provides us a way to maintain all the const data at the same place making it more maintainable.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-1446">Jonathan Boccara</a>.</p>
<p>Having a constant in anonymous namespace also means we&#8217;ll allocate it only once. And one of the major disadvantage of having static variable is the thread safety provided by the standard &amp; compiler. So, even though the data is const, compiler generates locks before that for thread safety. Although this happens mostly with the objects which requires dynamic allocation(like std::string). For rest, (like int), compiler optimisations do their job properly.<br />
On that other hand, if its in anonymous namespace, it might be directly substituted by compiler optimisation based on flag as well and no thread locking related code is generated. And also provides us a way to maintain all the const data at the same place making it more maintainable.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-1446</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Thu, 08 Nov 2018 12:13:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=290#comment-1446</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-1434&quot;&gt;Shreyans&lt;/a&gt;.

Here the meaning of static means to allocate once, and not private to the file like the anonymous namespace. Do you mean that we shouldn&#039;t allocate it once then?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-1434">Shreyans</a>.</p>
<p>Here the meaning of static means to allocate once, and not private to the file like the anonymous namespace. Do you mean that we shouldn&#8217;t allocate it once then?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Shreyans		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-1434</link>

		<dc:creator><![CDATA[Shreyans]]></dc:creator>
		<pubDate>Fri, 02 Nov 2018 21:25:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=290#comment-1434</guid>

					<description><![CDATA[Great post.
In the final solution, you are using static const. It might not be high performant. I think it would be better to put it in anonymous namespace as const.]]></description>
			<content:encoded><![CDATA[<p>Great post.<br />
In the final solution, you are using static const. It might not be high performant. I think it would be better to put it in anonymous namespace as const.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-644</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Sun, 12 Nov 2017 21:58:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=290#comment-644</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-633&quot;&gt;Владимир Невзоров&lt;/a&gt;.

Hello, so the only piece that isn&#039;t shown in detailed implementation in the post is the consecutive adaptor. Here is the one in the range-v3 library, which is called ranges::view::sliding instead of &quot;consecutive&quot;: https://github.com/ericniebler/range-v3/blob/afd3c77dabdf9816ffb7e266a8d9d55b86005834/include/range/v3/view/sliding.hpp.
For the rest, all the code is included in this post unless I&#039;m mistaken.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-633">Владимир Невзоров</a>.</p>
<p>Hello, so the only piece that isn&#8217;t shown in detailed implementation in the post is the consecutive adaptor. Here is the one in the range-v3 library, which is called ranges::view::sliding instead of &#8220;consecutive&#8221;: <a href="https://github.com/ericniebler/range-v3/blob/afd3c77dabdf9816ffb7e266a8d9d55b86005834/include/range/v3/view/sliding.hpp" rel="nofollow ugc">https://github.com/ericniebler/range-v3/blob/afd3c77dabdf9816ffb7e266a8d9d55b86005834/include/range/v3/view/sliding.hpp</a>.<br />
For the rest, all the code is included in this post unless I&#8217;m mistaken.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Владимир Невзоров		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-633</link>

		<dc:creator><![CDATA[Владимир Невзоров]]></dc:creator>
		<pubDate>Tue, 07 Nov 2017 08:18:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=290#comment-633</guid>

					<description><![CDATA[Thanks for a great post! I really want to go deep and look for a code of this refactored example. Could you provide it?]]></description>
			<content:encoded><![CDATA[<p>Thanks for a great post! I really want to go deep and look for a code of this refactored example. Could you provide it?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yulivee		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-48</link>

		<dc:creator><![CDATA[Yulivee]]></dc:creator>
		<pubDate>Sat, 07 Jan 2017 23:23:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=290#comment-48</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-46&quot;&gt;Jonathan Boccara&lt;/a&gt;.

Thanks for the reply =)
Looking forward to the new article and the next challenge. Great blog! =)]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-46">Jonathan Boccara</a>.</p>
<p>Thanks for the reply =)<br />
Looking forward to the new article and the next challenge. Great blog! =)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-46</link>

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

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-42&quot;&gt;Yulivee&lt;/a&gt;.

Hi Tina,

I think you&#039;re 100% right in that using a lambda would be more adapted than a functor here. Now this functor here has the slight advantage over a named lambda of completely hiding the implementation code from the `computeNumberOfBreaks` function.

However this can also be achieved with a bit more work on the lambda,  although I guess that you got how since you seem already quite familiar with lambdas.

I may be wrong here but I think that dedicating a blog post to this particular technique on lambdas will make posts more modular, as opposed to cramming everything in this single post.

This article on lambdas is coming up on Jan 20, and I&#039;ll be very keen on hearing your thoughts on it when you read it :)

And boost can be used on challenges for expressive code.

Thanks for your comment and stay tuned on Fluent C++]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-42">Yulivee</a>.</p>
<p>Hi Tina,</p>
<p>I think you&#8217;re 100% right in that using a lambda would be more adapted than a functor here. Now this functor here has the slight advantage over a named lambda of completely hiding the implementation code from the `computeNumberOfBreaks` function.</p>
<p>However this can also be achieved with a bit more work on the lambda,  although I guess that you got how since you seem already quite familiar with lambdas.</p>
<p>I may be wrong here but I think that dedicating a blog post to this particular technique on lambdas will make posts more modular, as opposed to cramming everything in this single post.</p>
<p>This article on lambdas is coming up on Jan 20, and I&#8217;ll be very keen on hearing your thoughts on it when you read it 🙂</p>
<p>And boost can be used on challenges for expressive code.</p>
<p>Thanks for your comment and stay tuned on Fluent C++</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yulivee		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-42</link>

		<dc:creator><![CDATA[Yulivee]]></dc:creator>
		<pubDate>Fri, 06 Jan 2017 21:54:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=290#comment-42</guid>

					<description><![CDATA[I don&#039;t get why you didn&#039;t use a lambda, neither. It&#039;s simpler, more readable and you can give it a name as well. (Maybe it&#039;s a matter of what you are used to.)

const auto FartherThan = (const auto&#038; cities)[&#038;]
{
        return cities.first.getGeographicalAttributes().getLocation().distanceTo(
                          cities.second.getGeographicalAttributes().getLocation()) &#062; MaxDistance; 
};

Pass this on to your copy_if like you did with the functor.

And if you use boosts copy_if you won&#039;t have to write your own version. Or is using boost not part of the challenge?]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t get why you didn&#8217;t use a lambda, neither. It&#8217;s simpler, more readable and you can give it a name as well. (Maybe it&#8217;s a matter of what you are used to.)</p>
<p>const auto FartherThan = (const auto&amp; cities)[&amp;]<br />
{<br />
        return cities.first.getGeographicalAttributes().getLocation().distanceTo(<br />
                          cities.second.getGeographicalAttributes().getLocation()) &gt; MaxDistance;<br />
};</p>
<p>Pass this on to your copy_if like you did with the functor.</p>
<p>And if you use boosts copy_if you won&#8217;t have to write your own version. Or is using boost not part of the challenge?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-37</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Tue, 03 Jan 2017 23:18:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=290#comment-37</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-36&quot;&gt;Jerry Coffin&lt;/a&gt;.

Hey Jerry,

Thanks a lot for proposing your solution to the challenge for the most expressive code.

I personally reviewed your solution. Although there could be one winner only, what I could say for sure is that your code shows that you know your stuff. You proposed a smart solution using various modern technologies, and provided interesting comments alongside. We need more people like you to share their opinions and knowledge on Fluent C++.

Indeed you&#039;ll get more about lambdas on Jan 20th, and much more to come until then (posts are up every Tuesday and Friday) so stay tuned, and hoping to hear more from you in the next posts.

Jonathan
]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/01/03/super-expressive-code-by-raising-levels-of-abstraction/#comment-36">Jerry Coffin</a>.</p>
<p>Hey Jerry,</p>
<p>Thanks a lot for proposing your solution to the challenge for the most expressive code.</p>
<p>I personally reviewed your solution. Although there could be one winner only, what I could say for sure is that your code shows that you know your stuff. You proposed a smart solution using various modern technologies, and provided interesting comments alongside. We need more people like you to share their opinions and knowledge on Fluent C++.</p>
<p>Indeed you&#8217;ll get more about lambdas on Jan 20th, and much more to come until then (posts are up every Tuesday and Friday) so stay tuned, and hoping to hear more from you in the next posts.</p>
<p>Jonathan</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
