Writing multithreaded code is hard. You want to utilize all of the machine’s processing power, keep code simple and avoid data races at the same time.
Let’s see how C++17 can make writing parallel code a bit easier.
Intro With C++11⁄14 we’ve finally got threading into the standard library. You can now create std::thread and not just depend on third party libraries or a system API.
Although C++ is an old programming language, its Standard Library misses a few basic things. Features that Java or .NET had for years were/are not available in STL. With C++17 there’s a nice improvement: for example, we now have the standard filesystem!
Traversing a path, even recursively is so simple now!
With each C++ standard, we aim for simpler, cleaner and more expressive code. C++17 offers several “big” language features that should make our code nicer. Let’s have a look.
Intro You might say that most of the new language features (not to mention The Standard Library improvements) are there to write simpler/cleaner code.
Is C++ well suited for writing fast small utilities/tools?
Let’s see:
For my recent giveaway I needed a tool that would take an input file - CSV with data and then draw a few winners from all of the entries. To make things more complicated each entry might have a different weight.
For C++17 everyone wanted to have concepts, and as you know, we didn’t get them. But does it mean C++17 doesn’t improve templates/template meta-programming? Far from that! In my opinion, we get excellent features.
Read more for details.
Intro Do you work a lot with templates and meta-programming?
With C++17 we get a few nice improvements: some are quite small, but also there are notable features as well!
In May 2017 we got one more book about Modern C++! A Few weeks ago I got a copy from Packt Publishing, and today I’d like to write a few words about the book. In short: it’s a very good book! :)
But let’s see what’s inside…
The Book < a href=“http://amzn.
The second part of my series about C++17 details. Today I’d like to focus on features that clarify some tricky parts of the language. For example copy elision and expression evaluation order.
Intro You all know this… C++ is a very complex language, and some (or most? :)) parts are quite confusing.
The new C++ Standard - C++17 - is near the end to be accepted and published. There’s already a working draft, and not that long ago it went to the final ISO balloting. It’s a good occasion to learn and understand what are the new features.
Let’s start slowly, and today we’ll look at language/library fixes and removed elements.
Last time I wrote about final_act utility, and it seems I’ve stepped into a bigger area that I wasn’t aware of. Let’s continue with the topic and try to understand some of the problems that were mentioned in the comments.
Intro Let’s remind what was the case last time:
Sometimes there’s a need to invoke a special action at the end of the scope: it could be a resource releasing code, flag set, code guard, begin/end function calls, etc. Recently, I’ve found a beautiful utility that helps in that cases.
Let’s meet gsl::final_act/finally.
Intro Follow-up post here: link.
As you’ve might already notice I’ve made a little joke on Saturday, which was the April Fools’ Day. I got the courage to announce C++18 next year! :)
While it was a bit funny, I didn’t expect much traffic (as it was Saturday). Still, my stats shows that a lot of people clicked and viewed the post.
You want to transform one file into another, input into output. What API will you choose on Windows? WinApi? C++ Streams or good old stdio?
Last year in September I looked at four ways of processing a file on Windows. Also, I did some performance tests.
The whole project description was recently published in Visual Studio Magazine.