The C++ Stories Weekly Newsletter

Join ~11000 developers who read about Modern C++, news reports, tools, and more! A new email every Monday.
Bonuses included! C++23/C++20/C++17 ref cards and more!

The above field is supplemented with consent to receive a newsletter containing information and marketing content about the cppstories.com portal from Bartłomiej Filipek codebf based in Krakow. The consent may be withdrawn at any time. See the full Privacy Policy.


See the latest articles:

C++ Links #2

Updated:

Welcome to new C++ Links - most important and useful articles, podcasts and videos that happened between 8th and 14th of September. Today you will find a link to a post about the C++ quality of life features, a video with an explanation of the difference between const and constexpr, an article that describes some of SFINAE problems and many others.

READ MORE...

C++ Links #1

Updated:

I’d like to make an experiment on the blog and introduce a new simple series. Each Friday you’ll see a summary with valuable links and resources from the C++ World. The links and annotations are coming from a guest author - Wojciech Razik - one of the co-author of cpp-polska.pl.

READ MORE...

Preprocessing Phase for C++17's Searchers

Updated:

Searchers from C++17 are a new way to perform efficient pattern lookups. The new standard offers three searchers: default_searcher, boyer_moore_searcher and boyer_moore_horspool_searcher. The last two implements algorithms that require some additional preprocessing for the input pattern. Is there a chance to separate preprocessing time from the search time? Short Reminder   In my last article I’ve introduced searchers that were added into C++17.

READ MORE...

C++17 In Detail Book!

Updated:

I’m happy to present my first ebook on C++! Here’s the short story and the description of what you can find inside. The Story   At the beginning of 2017, I decided to make a super long, collaborative, post about all the new things that are coming with C++17. At that time we had quite “stable” drafts, so most of the new features were already known.

READ MORE...

How to Initialize a String Member

Updated:

How do you initialise a string member in the constructor? By using const string&, string value and move, string_view or maybe something else? Let’s have a look and compare possible options. Intro   Below there’s a simple class with one string member. We’d like to initialise it. For example: class UserName { std::string mName; public: UserName(const std::string& str) : mName(str) { } }; As you can see a constructor is taking const std::string& str.

READ MORE...

Performance of std::string_view vs std::string from C++17

Updated:

In this text we’ll have a look at a few examples that compare std::string_view against std::string. How much is std::string_view faster than standard std::string operations? Intro   I was looking for some examples of string_view, and after a while, I got curious about the performance gain we might get. string_view is conceptually only a view of the string: usually implemented as[ptr, length].

READ MORE...

In-Place Construction for std::any, std::variant and std::optional

Updated:

When you read articles or reference pages for std::any, std::optional or std::variant you might notice a few helper types called in_place_* available in constructors. Why do we need such syntax? Is this more efficient than “standard” construction? Intro   Chinese version here: C++ std::any、std::variant和std::optional的原位构造(In-Place Construction)_yihuajack的博客-CSDN博客 We have the following in_place helper types:

READ MORE...

Parallel STL And Filesystem: Files Word Count Example

Updated:

Last week you might have read about a few examples of parallel algorithms. Today I have one more application that combines the ideas from the previous post. We’ll use parallel algorithms and the standard filesystem to count words in all text files in a given directory. The Case   In my previous post, there were two examples: one with iterating over a directory and counting the files sizes and the next one about counting words in a string.

READ MORE...