C++17 In Detail

31 December 2019

C++ at the end of 2019

C++ at the end of 2019

2019 is almost over. Let’s reflect on how C++ changed during this time! What were some significant events, how the Standard progressed, how tools changed and many more.

Let’s have a look!

Previous reports: 2018, 2017, 2016, 2015, 2014, 2013, 2012.

Disclaimer: the view presented here is mine and does not represent the opinion of the entire ISO C++ Committee.

A Brief Introduction

Here are the main things for this year that got my attention:

  • C++20 is almost ready for publication
  • Tools
  • Stable position of C++ in popularity

Read on to get the full picture.

Timeline

The below table helps to see the main events:

Date Event
04 - 06 February C++ On Sea
22 to 27 February Kona, USA, ISO C++ Meeting
20 March Clang 8.0.0
02 April Visual Studio 2019 Available!
09 - 13 April ACCU Spring Conference
12 April Boost 1.70.0 Released
03 May GCC 9.1 Released
10 May Clang 7.1.0
21 May Visual Studio 2019 16.1
15 - 20 July Cologne, Germany, ISO C++ Meeting
19 July Clang 8.0.1 Released
24 July Visual Studio 2019 16.2 Released
12 August GCC 9.2 Released
14 - 22 September Cppcon 2019
19 September Clang 9.0.0 Released
23 September Visual Studio 2019 16.3 Released
31 October - 01 November C++ Russia Conference
04 - 09 November Belfast, Northern Ireland, ISO C++ Meeting
14 - 16 November Meeting C++ 2019 Conference
20 - 21 November code::dive Conference in Wroclaw/Poland
03 December Visual Studio 2019 16.4 Released

Compiler support for C++11/14

Just for the completeness and reminder Clang (since 3.4 ), GCC (since 5.0) and Intel (version 15.0) already have full support for C++11/14.

Visual Studio Team announced full conformance with C++17 with the version 2017, 15.7… and that also means the support for C++11/14. Now, you can build complex codebases like boost::hana or range v3.

Since C++11/14 is supported in all major compilers, you have no excuses not to use modern C++ :)

Compiler support for C++17

In December 2017 C++17 was published as ISO/IEC 14882:2017 Programming languages – C++.

You can download a free version of the last draft: N4700, 2017-10-16, PDF.

The full version of compiler support can be found @cppreference: C++17 compiler support,

Or you can read my blog posts:

C++17 Features

Or get my Language Ref Card:

Regarding Language Features:

Starting from Clang 5.0, GCC 8.0, Visual Studio 15.7 and Intel C++ Compiler 19.0.1 we can say that all the compiler support language features.

More work needed to be done for The Standard Library: Especially when we talk about large things like parallel algorithms and the filesystem.

For std::filesystem you need GCC 8.1 (or better GCC 9.1), Clang 3.9 (or better 7.0) and Visual Studio 2017 15.7.

The parallel algorithm update was first available in Visual Studio 2017 15.7, but with later updates, the MSVC team added a few more algorithms.

Then you can use Intel PSTL implementation, and it was also added into GCC 9.1. You need Intel Threading Building Blocks as the backend implementation. Have a look at this article.

C++17 STL Parallel Algorithms - with GCC 9.1 and Intel TBB on Linux and macOS by Paul Silisteanu

And we’re still waiting for Clang Library to catch up.

Another issue is with the implementation of low-level conversion functions.

Visual Studio stared to supportfrom_chars()/to_chars()for integers from 15.7, and then added floating point support for from_chars() with 15.8. But the fully conformant implementation is available in 16.4 (floating point version for to_chars()).
So far Clang and GCC versions only support integer numbers. Maybe due to MSVC STL implementation being open-sourced, we can expect that some code will be ported into those other Standard Library implementations.

C++20

Discussions on C++20 dominate this year. The feature freeze happened during the Summer ISO C++ Meeting in Cologne. Later, in Belfast, some of the first national body comments were resolved.

All in all, it means that we’re on an excellent path to publishing the new standard next year!

As for the major features we can list the following things:

  • Modules
  • Coroutines
  • Concepts With Standard Library Concepts
  • Ranges
  • constexpr support: new/delete, dynamic_cast, try/catch, virtual
  • constexpr vector and string!
  • Chrono: calendar, time zone support
  • std::format - see std::format in C++20
  • std::span
  • std::jthread

What’s more, a lot of C++20 features are already implemented in the popular compilers. The biggest things like modules are still not done (we have only some experimental TS implementations).

The full list is as usual available at cppreference: C++20 compiler support, but here I’d like to list a few:

Feature GCC Clang Visual Studio
P0515R3 Three-way comparison operator <=> 10.0 in progress VS 16.0
P0941R2 Feature-test macros 5.0 9.0, ongoing VS 16.0
P1008R1 Prohibiting aggregates with user-declared constructors 9.0 8.0 VS 16.1
P0780R2 Allowing pack expansion in lambda init-capture 9.0 9.0 VS 16.2
P0734R0 Concepts 10.0 no VS 16.3
P1091R3 Extending structured bindings to be more like variable declarations 10.0 partial VS 16.4
P0614R1 Range-based for-loops with initializers 9.0 8.0 no
P0912R5 Coroutines no partial no
P1103R3 Modules no partial no
P0896R4 ranges no no no

ISO C++ Meetings

There were three committee meetings this year - in Kona, Cologne and Belfast. This year it seems that the Committee prefers to stay in Europe :)

The plan for the meetings is available here: Upcoming Meetings and Past Meetings

The next one is planned in February 2020, in Prague.

February: Kona, USA

New things that were voted into C++20:

  • Modules - P1103!
  • Coroutines - N4736!
  • Extending structured bindings to be more like variable declarations - P1091R3
  • std::polymorphic_allocator<> - P0339
  • std::midpoint and std::lerp - P0811
  • std::execution::unseq execution policy P1001
  • std::ssize free function that returns a signed size - P1227
  • Precalculated hash values in lookup - P0920

Parallelism TS v2 was also published as ISO/IEC TS 19570:2018 - Programming Languages – Technical Specification for C++ Extensions for Parallelism.

The main trip report summary:

r/cpp: 2019-02 Kona ISO C++ Committee Trip Report

and post Kona mailing

Other trip reports:

July: Cologne, Germany

This meeting was a feature freeze meeting for the C++20 standard. This was the last chance for a feature to be voted in.

Also, this time a major feature was voted out from the draft. Contracts were very appealing, but actually, the committee could not agree on the final implementation points. So it was decided that it’s better to form a separate study group and try to prepare the feature for C++23.

Some notable changes and feature:

  • Contracts moved out of C++20; Contracts Study Group created.
  • std::format("For C++{}", 20) -P0645
  • The C++20 Synchronization Library - P1135
  • constexpr allocation P0784
  • Making std::vector constexpr - P1004
  • Making std::string constexpr - P0980
  • Stop Token and Joining Thread - P0660
  • source_location - P1208
  • using enum - P1099
  • constinit - P1143
  • Math Constants (std::numbers::pi and friends) - P0631
  • Rename Concepts from PascalCase to snake_case - P1754
  • Deprecating volatile - P1152
  • Layout-compatibility and pointer-interconvertibility Traits - P0466
  • [[nodiscard]] for constructors - P1771
  • Improved iterator concept hierarchy - P1207
  • Move-only views - P1456
  • Additional views and range adaptors - P1035
  • Integrate operator<=> into the standard library - P1614
  • Extensions for class template argument deduction - P1021

The main meeting summary: r/cpp thread - cologne meeting.

And the post Cologne mailing

Trip reports:

November: Belfast, Northern Ireland

This time the Committee didn’t vote any new features but spent most of the time on solving the national body comments for the C++20 draft.

The main trip report at r/cpp:

Post-meeting mailing: https://isocpp.org/blog/2019/12/2019-11-post-belfast-mailing-available

Other trip reports

Compiler Notes

Current versions and most notable updates.

Visual Studio

The current version is Visual Studio 2019 16.4, last update in 3rd December - Release
notes
.

This year we had a launch of new version Visual Studio 2019! It brings lots of new features and enhancement to the already superb IDE.

Here’s the initial launch post: Visual Studio 2019: Code faster. Work smarter. Create the future. | Visual Studio Blog

Some notable features:

  • AI-assisted code completion with Visual Studio IntelliCode
  • Clang-Tidy support in C++ MSBuild and CMake projects, for both Clang and MSVC.
  • AddressSanitizer support for projects compiled with MSVC on Windows.
  • Better integration with CMake
  • Concepts are available in 16.3
  • full to_chars() support, that finishes the C++17 requirements!
  • A new collection of tools named C++ Build Insights is now available. See the C++ Team Blog for more information.

Another major update came from Cppcon where the MSVC team announced their Standard Library Implementation to be open source! Have a look:
Open Sourcing MSVC’s STL | C++ Team Blog

Some other news:

And here’s a documentation page about the conformance with C++ Standards (including C++20):
Microsoft C++ language conformance table

GCC

Current stable version GCC 9.2, August 12th, GCC 9 Release Series Changes

Clang

Current stable version: 9.0 - 19th Sept 2019, Release Notes

Intel compiler

The Version 19.1 appeared in April 2nd (release notes)

C++ Builder

The current version is Rio 10.3 update 3. Latest release in November 21st, 2019, see Release notes.

The IDE uses a modified Clang Compiler (version 5.5) and the Dinkumware STL implementation It works with both Win32 and Win64 apps. Embarcadero C++ Builder is a full featured IDE for building iOS, Android, Windows and macOS apps from a single C++ codebase.

Some of the news:

And here you can see a conformance table for tha C++ features:
Modern C++ Language Features Compliance Status

Tools

While compilers do the primary job with our C++ code, we cannot forget about the importance of other tools.

Here are some important tools that it’s worth to know:

Clang Tools:

Clang/LLVM powers many great utilities! For example:

IDE and Productivity

For a better code understanding, you can also have a look at SourceTrail. It was recently released as fully free version!
Sourcetrail is now free and open-source software – Sourcetrail Developer Blog

Code Analyzers:

  • CppDepend v2019.3
  • PVS-Studio - a tool for bug detection in the source code of programs, written in C, C++, and C#. It works in Windows and Linux environment
    • The latest version is PVS-Studio 7.05, see all Release notes from this year
    • Some of the notable changes this year: Analysis of .NET Core 3 and 3.1 projects, MISRA guidelines support, more than 40 new checks, support for Java, SonarQube plugins.

Package Managers:

Conferences

We cannot complain about the lack of C++ conferences :) There are many options, especially around Spring and then in Autumn, To name a few code events:

  • CppCon - September 2019
  • C++Now - May 2019
  • Meeting C++ - November 2019
  • ACCU - April, and then the Autumn edition in November

But there are more: like Code::Dive, Italian C++ Conference, C++ on Sea, C++ Italian Day C++Russia, or Core C++ 2019.

It’s also amazing that if you haven’t been at a conference, you can quickly type its name on YouTube and find most of the lectures from it. You can easily find trip reports using some web search engine.

Just in case here’s the link to ISO C++ page with all registered conferences around the world: Conferences Worldwide, C++FAQ.

Community & User Groups

User groups are a chance for you to meet other C++ programmers, share your experience and learn new things. I highly recommend visiting such groups regularly… or at least once in a while.

I am delighted that my city - Cracow - continued its C++ group this year: C++ User Group Krakow - join if you’re nearby!

If you don’t have a User Group close to your place (but please check User Groups Worldwide), you can also participate in:

C++ Poland

C++ Polska

Additionally this year we also pushed with the Polish C++ Blog: C++ Polska. We have several active authors there with great content every month!
We also started a Slack Channel where you can discuss C++ and non-C++ things :)
Join here: C++ Polska Slack

Books & Courses

Some of the books and courses released this year worth seeing:

One of the strong points here is John Lakos’ book! I’ve been waiting for that for several years, and it’s finally available!

Name Release Date
Large-Scale C++ Volume I: Process and Architecture by John Lacos 27th December
C++ 17: Beyond the Basics by Kate Gregory 26th November
C++ Concurrency in Action 2nd Edition by Anthony Williams February 10, 2019
C++: The Ultimate Beginner’s Guide to Learn C++ Programming Step by Step by Ryan Turner November 5, 2019
C++ Crash Course: A Fast-Paced Introduction by Joshua Lospinoso September 24, 2019
Qt5 C++ GUI Programming Cookbook by Lee Zhi Eng March 27, 2019
Hands-On Design Patterns with C++ by Fedor G. Pikus January 30, 2019

And we also have the print versions of popular C++ self-published books:

Name Release Date
C++17 in Detail by Bartlomiej Filipek September 12, 2019
C++17 - The Complete Guide: First Edition by Nicolai M. Josuttis September 6, 2019
The Legacy Code Programmer’s Toolbox by Jonathan Boccara September 21, 2019

Popularity

Where is C++ regarding popularity? Is all eaten up by JavaScript?

Apparently not, as in some places C++ has grown or stayed at a stable position.

Let’s have a look at some charts/stats:

  • Tiobe shows C++ on the 4th place. It’s now 6.196%… Last year it was more than 7%, two years before it was around 5.5%.. See the chart here: Tiobe Index.
  • In the StackOverflow Survey C++ is positioned at 9th place, above C
    (but below Java, C# and of course JavaScript). But last year it was 10th place.
  • In GitHub survey, C++ has 6th place and moved down from 5th place that it had last year.

In my opinion, I feel that C++ is still strong among others. It’s not perfect, it’s not easy to learn… but a lot of code is built still with that language. Rust or other system languages won’t quickly replace it. The tools are getting better and better, the language aims to reduce the complexity (sometimes not :)), so the experience for beginners hopefully is getting better.

Yet, C++ is only a tool, and we can be grateful we have a lot of tools at our disposal today.

I also found a recent article from Daniel Lemire, who made some predictions on the programming and the programming languages ten years ago. He was positively surprised by the growth of C++:

From Daniel Lemire:

I would say that C++ has become a much better language since 2010. It is not any easier, but it has exceeded my expectations.

Your Input & Survey

More than a week ago, I started a quick survey where I wanted to get some data about C++ use. I got 574 answers! Thank you!

C++ Standard Used

On a daily basis, which C++ Standard do you use?

Answer 2019 2018
Pre C++11 10.3% 20%
C++11 30.3% 41%
C++14 35% 42%
C++17 62.4% 44%
C++20 9.2% n/a

(The numbers for the above do not sum to 100%)

C++ Use 2019 vs 2018

I didn’t specify what does “use” mean, so it can be both for production code and also hobby projects. For example there’s a high use of C++20, but I believe it’s mostly for testing and not yet for the full production code… or maybe I’m wrong?

Experience with C++17

What’s your experience with C++17?

Answer 2019 2018
experimenting with C++17 39.4% 48.5%
only read basic information 13.4% 24%
already using in production 41.6% 17.5%
don’t know any of its feature 2.6% 7%

This year we can see steady progress in the adoption of the C++ Standard.

Experience with C++20

What’s your experience with C++20?

Answer 2019 2018
experimenting with C++20 29.3% n/a
only read basic information 59.8% n/a
don’t know any of its feature 9.1% n/a

Compilers Used

What compiler do you use?

Answer 2019 2018
GCC 75.6% 73.5%
Clang 58.7% 41%
MSVC 56.3% 59%
Intel Compiler 3.1% 3%
Borland C++ 1.2% n/a

(The numbers for the above do not sum to 100%)

What additional tools do you use?

Answer 2019
Debugger 83.6%
Sanitizers 40.4%
Static Code Analysis 55.7%
Profilers 56.8%
Clang Format 49.3%
CMake 66%
Package Managers 21.4%

(The numbers for the above do not sum to 100%), Last year I didn’t ask that question.

I think that asking for using “debuggers” wasn’t super clever… as we probably can assume all of the devs use it at some point :)

Some “other” answers include: ccache, meson, make, Boost build, QMake, Autotools, cmake format, Emacs, Whole Tomato.

Best thing that happened in 2019:

This was an open question and from what I’ve seen the main things was as follows (no special order, based on occurrences in the list):

  • CppCon 2019
  • C++20 features and the standardization - you seem to be very excited by the new standard!
  • Modules in C++20
  • Coroutines
  • Concepts
  • Ranges
  • std::format
  • Code::Dive 2019
  • Meeting C++ 2019
  • C++ Blogs - easier to learn and stay up to date with the language
  • C++ Books and Courses - raising, more options available
  • C++ Cast
  • C++ Community - conferences, groups
  • Tools getting better: Clang build analyser, VS 2019, QTCreator, CLion

You also listed a few personal achievements: for example, someone started using C++17, someone had his first talk at a conference. You also motioned about the introduction of Conan in your project, or that you changed your job. There was also a comment about “being finally retired”. Good for all of you!

It’s also a pleasure to me that you also wrote that the best thing was my book :) Thank you! :)

For example:

“C++17 in Detail”, of course! The free version convinced me to use C++17 in my projects.

Other Surveys

Regarding surveys, The C++ Committee also sent us a survey in February.
They managed to gather more than 2000 votes.

Have a look: Second Annual C++ Foundation Developer Survey “Lite” : Standard C++ and the results.

There’s also a survey from Jetbrains:

C++ 2019 - The state of Developer Ecosystem in 2019 Infographic

Summary

Three things that I’d like to emphasise for the year:

  • C++20 is almost ready
  • Tools - it’s easier to write C++ code today!
  • Stable position of C++ in popularity

All in all, I think we can look positively on C++ in the next decade. Not sure what happens later, but for the next ten years, I believe that C++ should be relatively in a stable position. With all the tools, new C++ standard writing C++ code is more accessible and less error-prone. C++ is still the best choice for apps that require performance - it even takes over from C and Fortran.

(This post might be filled with typos, grammar issues, sorry for that I
hope to improve it during the next few days).

Your turn

  • What do you think about C++ in 2019?
  • What was the most important event/news for you?
  • Did I miss something? Let me know in comments!
C++17 In Detail
© 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.