C++17 In Detail

Hi there!

My name is Bartek, I'm a programmer from Cracow/Poland. This is my blog about C++ and native coding.

Quick jump links:

19 August 2019

New new() - The C++17's Alignment Parameter for Operator new()

Alignment parameter for C++17 new()

Last week’s article about smaller C++17 features mentioned updated operator new() that handles non-standard alignment of objects. How does it work? Can you use it to ask for arbitrary alignments? Let’s try some code and have a closer look.

16 August 2019

C++ Links #33 - Parallel Algorithms, Smaller Features, Pipes & Dropbox

Welcome to new C++ Links - most relevant and useful articles, podcasts and videos that happen between 9th and 16th August 2019.

Today you will find links to a list of smaller C++17 features, a free book about Intel TBB and parallel programming, why Dropbox is moving away from C++ and many more!

12 August 2019

17 Smaller but Handy C++17 Features

When you see an article about new C++ features, most of the time you’ll see a description of major elements. Looking at C++17, there are a lot of posts (including articles from this blog) about structured bindings, filesystem, parallel algorithms, if constexpr, std::optional, std::variant… and other prominent C++17 additions.

But how about those smaller parts? Library or language improvements that didn’t require decades to standardise or violent “battles” at the ISO meetings.

In this article, I’ll show you 17 smaller C++17 things that will improve your code.

10 August 2019

C++ Links #32 - QT6, How to Fix C++ and what's Debugging in C++

Welcome to new C++ Links - most relevant and useful articles, podcasts and videos that happen between 2nd and 9th August 2019.

Today you will find links to ideas on how to Fix C++, how to bring more performance for SIMD math library with C++17, how QT 6 will look like, and more.

02 August 2019

C++ Links #31 - bugs in Bullet Engine and C++20

Welcome to new C++ Links - most relevant and useful articles, podcasts and videos that happen between 27th July and 2nd August 2019.

Today you will find links to Bugs in Game Engines, articles about C++14 and C++20, debugging move techniques, hot to break RAII and more.

29 July 2019

Moved or Not Moved - That Is the Question!

Debug Move, C++

C++11 brought Move Semantics. Since then we have extra capabilities to write faster code, support movable-only types, but also more headaches :). At least I have, especially when trying to understand the rules related to that concept. What’s more, we also have copy elision, which is a very common optimisation (and even mandatory in several cases in C++17). If you create an object based on another one (like a return value, or assignment), how do you know if that was copied or moved?

In this article I’ll show you two ways how to determine the status of a new object - copied, moved or copy-elision-ed. Let’s start!

26 July 2019

C++ Links #30 - Contracts Removed from C++20!

Welcome to new C++ Links - most relevant and useful articles, podcasts and videos that happen between 19th and 26th of July 2019.

Today you will find links to Cologne Trip reports, where the final shape of C++20 was formulated! And then you’ll also read about constant globals, __has_include and some tools updates.

22 July 2019

Improve Multiplatform Code With __has_include and Feature Test Macros

Multiplatform code and __has_include, C++17

Two weeks ago, I showed you a sample that can detect if a function has a given overload. The example revolved around std::from_chars - low-level conversion routine for C++17. In the example, some “heavy” template patterns helped me to write the final code (most notably std::void_t and if constexpr). Maybe there are some other techniques we can use to check if a feature is available or not?

Today I’d like to have a look at __has_include and discuss the upcoming feature test macros that we’ll have in C++20.

15 July 2019

Five Awesome C++ Papers for Cologne ISO Meeting

Cologne 2019 ISO C++ Meeting

Today is the start day of Summer C++ISO meeting, this time in Cologne, Germany! This is the “feature-complete” meeting for C++20. It’s the last time we’ll see some new elements that are merged into the working draft.

Let’s see what’s already in C++20 and let’s have a look at some smaller, but very handy proposals that might get into the standard. This is similar to article that I did for Kona and San Diego Meetings.

08 July 2019

How To Detect Function Overloads in C++17, std::from_chars Example

Detect Function Overload, C++17

The problem: a library function offers several overloads, but depending on the implementation/compiler, some of the overloads are not available. How to check the existence of an overload? And how to provide a safe fallback?

In this article, I’ll show you a background “theory” and one case - std::from_chars that exposes full support for numbers or only integer support (in GCC, Clang).

01 July 2019

[Quick Case] Surprising Conversions of const char* to bool

Surprising conversions of const char* and bool, C++

If you have two function overloads foo(): one is taking const std::string& and the other taking bool. Which one of them will be selected when you call foo("hello world"); ?

Let’s see where such a case might bite us and cause troubles?

24 June 2019

C++17 In Detail, June Update: Foreword and Printing Tests

C++17 In Detail

Last Friday my book got a fresh update! It’s been three months since the previous release, and this time I brought foreword, new book format and some small content changes.

17 June 2019

Space Game: A std::variant-Based State Machine by Example

Space Game: A std::variant-based state machine by example

One of a powerful uses of std::variant is to implement State Machines. Some time ago I showed a simple example, but today we have something bigger. In today’s article by Nikolai Wuttke you’ll see how to leverage std::variant and build a space game!

27 May 2019

Heterogeneous Lookup in Ordered Containers, C++14 Feature

heterogeneous lookup in ordered containers, C++14

If you have a map of strings, like std::map<std::string, int> m; and you want to find some element by m.find("abc"). Do you have to pay the price and construct a std::string object? Can you optimize it?

Let’s have a look at one feature enabled in C++14 that might help optimize such container access.

© 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.