Lambda expressions are one of the most powerful additions to C++11, and they continue to evolve with each new C++ language standard. In this article, we’ll go through history and see the evolution of this crucial part of modern C++.
The second part is available:
Lambdas: From C++11 to C++20, Part 2
While I was doing research for my book and blog posts about C++17 several times I stumbled upon this pattern for visitation of std::variant:
template<class... Ts> struct overload : Ts... { using Ts::operator()...; }; template<class... Ts> overload(Ts...) -> overload<Ts...>; std::variant<int, float> intFloat { 0.0f }; std::visit(overload( [](const int& i) { .
On Friday 18th January I’ve pushed another update for the book. This time I rewrote the whole chapter about std::filesystem. Please have a look at what changed and what are the plans.
The book got more than 25 new pages!
std::filesystem - Chapter Rewrite The book had a filesystem chapter from the start, but it was concise and didn’t contain much information.
Subtitle: Learning std::filesystem through file_size routines.
Last week I wrote a short post that explained how to use std::filesystem::file_size. Today I’d like to continue and show some significant differences that this new functionality has over the “older” techniques (like reading a file and getting its file position).
We’ll also learn something about permissions and how to manage them in std::filesystem.
Before C++17 we could often complain that even simple tasks as getting a file size were complicated. With std::filesystem things get a bit easier!
Get a File Size STL before C++17 didn’t contain any direct facilities to work with a filesystem. We could only use third party libraries (like Boost), or system APIs.
2018 is almost over (just a few hours left in Poland till midnight). As in previous years, I did a summary of many things that happened in the C++ community. This year seems to be marked with a solid progress towards the standardisation of C++20, using more and more C++17 and as always the growth in the community.
Learning new language and library features in isolation might not be the best choice. That’s why in my book I also added bigger examples where many C++ elements coexist together.
This time I’d like to describe another book update where I create and walk through a CSV reader application. The application uses a lot of language and library components.
With C++17 we get another facility to handle the conversion between text and numbers. Why should we care about the new routines? Are they better in any way?
Intro C++, before C++17, offered several options when it comes to string conversion:
sprintf / snprintf sscanf atol strtol strstream stringstream to_string stoi and similar functions And with C++17 you get another option: std::from_chars!
Welcome to new C++ Links - most important and useful articles, podcasts and videos that happen between 24th and 30th of November. In this week you can found links to blog post series about good interface design, benchmarks for C++17 parallel algorithms, a video about compiler attributes and many more!
C++17 brings us parallel algorithms. However, there are not many implementations where you can use the new features. The situation is getting better and better, as we have the MSVC implementation and now Intel’s version will soon be available as the base for libstdc++ for GCC. Since the library is important, I’ve decided to see how to use it and what it offers.
Welcome to new C++ Links - most important and useful articles, podcasts and videos that happen between 10th and 16th of November.
This week we have link to another ISO C++ Standards Committee Meeting report - this time from Herb Sutter, you can also find link to video with unusual initialization using Designated Initializers.
Welcome to new C++ Links - most important and useful articles, podcasts and videos that happen between 3rd and 9th of November.
In this week we have C++ Standards Committee meeting in San Diego, we all can’t wait when first reports come out! Until then - one of the links is Herb Sutter pre-meeting trip report.