C++17 In Detail

31 March 2021

C++ Stories in March

See my new website at cppstories.com


Have a look at a short summary of the best articles from March 2021 from the C++ community.

Reminder: I publish new articles at the converted website cppstories.com.

constexpr new

constexpr Dynamic Memory Allocation, C++20 - C++ Stories

constexpr has become a major feature for compile-time programming in C++. Introduced in a simple form in C++11 evolved into almost another “sub-language”, an alternative to regular template code. In C++20 you can even use std::vector and std::string in constexpr context! In the article, I discuss constexpr memory allocations, a building block for std::vector and std::string.

Non-terminal

Non-Terminal Variadic Parameters and Default Values - C++ Stories

Currently, as of C++20, there’s no support for so called non-terminal variadic arguments. For example, we cannot write:

template <class ...Args> void func(Args&& ...args, int num=42);
func(10, 20); // error

As you can see, I wanted 10 and 20 to be passed as ...args and 42 as a default value for num. Compilers currently cannot resolve this code.

In this blog post, I show you a couple of tricks you can implement to avoid this issue. Knowing those techniques might help with things like logging functions where we could have std::source_location at the end of a function declaration.

Improving print

Improving Print Logging with Line Pos Info & Modern C++ - C++ Stories

Adding information about the line number and the file where the log message comes from is a very efficient method that might save you a lot of time. In this post, I describe one trick that is especially useful in Visual Studio but might also help in other IDE/compilers. I also show you how modern C++ and C++20 make code better.

Parallel compilation

Parallel Compilation Experiments in C++Builder and Dev C++ - C++ Stories

Thanks to lots of CPU cores available even in basic computer system we can significantly speed up compilation our projects. In a new article, you can look at techniques and experiments with building things faster in C++ Builder and a well-known free IDE DevC++.

C++ News

New C++ Proposals

A new list of proposals from the C++ ISO Committee - see at ISO/IEC JTC1/SC22/WG21 - Papers 2021 03.

Some interesting papers?

List of Software written in C++

List of some famous software written in C++ | Terminal Root

This is a short and concise list of the most popular apps that use C++ as a core programming language. From Windows OS, Chrome, Office, PayPal backend to Oracle Databases, Unreal Engine, and others.

And we can also link to C++ Applications maintained by Bjarne Stroustrup. It has a more extensive list.

And my addition: At Xara (a company where I work), C++ is one of the core elements of the whole infrastructure. It made it possible to build an advanced document editor back in the 1990s and today.

Resolving a function call in C++

How C++ Resolves a Function Call

It’s an excellent and very detailed article by Jeff Preshing. He describes the following parts:

  • Name lookup: member, qualified and unqualified
  • Special handling for function templates (for example, SFINAE)
  • Overload resolution: finding the best viable candidate

What’s best? There are small but good examples, with some real-life code. And there are amazing diagrams :) Even with sumo fighters!

See you in April! :)

If you want to get additional C++ resources, exlusive articles, early access content, private Discord server and weekly curated news, check out my Patreon website: (see all benefits):

© 2017, Bartlomiej Filipek, Blogger platform
Disclaimer: Any opinions expressed herein are in no way representative of those of my employers. All data and information provided on this site is for informational purposes only. I try to write complete and accurate articles, but the web-site will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.