Is std::for_each obsolete?--Jonathan Boccara
Do you agree?
Is std::for_each obsolete?
by Jonathan Boccara
From the article:
Today we explore a question about std::for_each. Enjoy the reading!
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 3-8, Kona, HI, USA
By Adrien Hamelin | Apr 4, 2018 03:14 PM | Tags: intermediate c++11
Do you agree?
Is std::for_each obsolete?
by Jonathan Boccara
From the article:
Today we explore a question about std::for_each. Enjoy the reading!
By Adrien Hamelin | Apr 4, 2018 03:12 PM | Tags: intermediate c++17
What do you think?
std::string_view is a borrow type
by Arthur O’Dwyer
From the article:
Today I’d like to talk about std::string_view. string_view arrived in C++17, amid quite a bit of confusion about what exactly it’s for and how to use it safely...
By Adrien Hamelin | Apr 3, 2018 02:01 PM | Tags: performance intermediate c++17
Be careful.
Using Parallel <algorithm> Without a Clue: 90x Performance Loss Instead of 8x Gain
by "No Bugs" Hare
From the article:
With C++17 supporting1 parallel versions of the std:: algorithms, there are quite a few people saying “hey, it became really simple to write parallel code!”.
Just as one example, [MSDN] wrote: “Only a few years ago, writing parallel code in C++ was a domain of the experts.” (implying that these days, to write parallel code, you don’t need to be an expert anymore).
Inquisitive hare:
“I made an experiment which demonstrates Big Fat Dangers(tm) of implying that parallelization can be made as simple as just adding a policy parameter to your std:: call.
I always had my extremely strong suspicions about this position being deadly wrong, but recently I made an experiment which demonstrates Big Fat Dangers(tm) of implying that parallelization can be made as simple as just adding a policy parameter to your std:: call...
By Adrien Hamelin | Mar 29, 2018 03:39 PM | Tags: c++11 advanced
Everything you need to know.
Guidelines For Rvalue References In APIs
by Jonathan Müller
From the article:
I’ll be giving a talk at ACCU about when to use which pointer types and why.
While working on that I made some guidelines for rvalue references in interfaces which didn’t quite fit the talk, so I’m writing about them here.
When should you use rvalue references as function parameters?
When as return types?
What are ref-qualified member functions and when and how should you use them?
Let’s tackle it one by one...
By Adrien Hamelin | Mar 29, 2018 03:15 PM | Tags: performance c++11
Performance!
My Little (String) Optimization, Part 2
by Jordan Rose
From the article:
Previously, I talked about how Clang is smart enough to optimize a series of comparisons against constant strings in C++ by starting out with a switch on the length. I left off with the idea that while this is good, you might be able to do better if your strings have a unique character at a certain offset. Today we’re going to see what that looks like.
By Adrien Hamelin | Mar 29, 2018 03:13 PM | Tags: experimental community
A good experience.
Freestanding trip report: emBO++ and Jacksonville wg21 2018 experience
by Ben Craig
From the article:
I'm the author of P0829, Freestanding Proposal. The tl;dr of the paper is that it standardizes a subset of the library suitable for kernel and embedded programming. R0 of this poorly titled paper was reasonably well received in the Albuquerque 2017 meeting. I was encouraged to send it out to a wider audience... and so I did. One of the people that I sent it to was Odin Holmes, and that got me an invitation to emBO++, my first speech at a public conference. This conference was the week prior to the Jacksonville meeting, so I ended up flying from Bochum to Jacksonville without going home first...
By Legalize Adulthood | Mar 29, 2018 06:49 AM | Tags: None
This article explores how to modernize your legacy C/C++ code base, using an open source fractal renderer originally written in C and x86 assembly language as the case study.
Give Your Old Code Some New Love
by Richard Thomson
From the article:
If you’re not careful, entropy creeps its way into your code base. You take a shortcut or code something in a way that you know is sloppy and you say to yourself “I’ll come back to that later”, but later you’re faced with new feature requests or some other Imminent Disaster(tm) and you don’t go back and clean up the mess you made earlier. This is only natural in a code base and when the messes are few and far between, it is tolerable.
[...]
In this post, we’ll take a look at an open source project with a code base that is over 30 years old and has accumulated some “cruft” along the way. We’ll discuss various strategies for coping with the cruft and how to get rid of it in as safe a manner as possible. After all, we don’t want to introduce bugs while we clean up cruft.
By Adrien Hamelin | Mar 19, 2018 01:12 PM | Tags: experimental advanced
What do you think?
The “unsigned for value range” antipattern
by Arthur O’Dwyer
From the article:
Background: Signed Integers Are (Not Yet) Two’s Complement
At the WG21 committee meeting which is currently underway in Jacksonville, JF Bastien will be presenting a proposal to make C++’s int data type wrap around on overflow. That is, where today the expression INT_MAX + 1 has undefined behavior, JF would like to see that expression formally defined to come out equal to INT_MIN...
By Adrien Hamelin | Mar 14, 2018 12:13 PM | Tags: intermediate
A tough problem.
String’s competing constructors
by Andrzej Krzemieński
From the article:
Let’s start with the problem. I want to check whether a program received a text message that consists of four consecutive zeroes. Not '0', but the numeric zero. I will create a constant std::string representing the special sequence and compare the messages (also stored as std::strings) I receive...
By Adrien Hamelin | Mar 12, 2018 12:34 PM | Tags: None
With examples.
Simplify code with 'if constexpr' in C++17
by Bartlomiej Filipek
From the article:
Before C++17 we had a few, quite ugly looking, ways to write static if (if that works at compile time) in C++: you could use tag dispatching or SFINAE (for example via std::enable_if). Fortunately, that’s changed, and we can now take benefit of if constexpr!
Let’s see how we can use it and replace some std::enable_if code.