C++11/14/17 Library Usage on Github

I recently collected a list of all the top level classes and free functions that are added for each of the modern C++ revisions (11/14/17) so that I could scan the Modern C++ example repository to find which library classes and functions don't yet have implementations. (Turns out... a lot!)

However, I am quite interested in how much of these modern standards are actually being adopted in real-world applications. As it was my experience when working in industry that the majority of C++ programmers, if not faced with wide usage of the modern concepts, did not independently do the research and work to keep up to date with the latest additions and methods. This leads to most code I see in the private sector looking like C++98 with the odd 'auto' and modern 'for' loop thrown in for convenience. 

Alternatively, you would see many classes and functions from Boost, which have now been ported over to the standard library - but I will come to this later.

To be able to get some solid figures on what is actually being used, I looked to the only large public set of searchable repositories we have - Github.
I used the Github HTTP API to query for the most popular (starred) repositories that are listed as C++. I then cloned all of these repositories to my machine (286 projects all together approx 120GB+ download...) and did some text analysis looking for the correct includes project wide and testing to see if these functions/classes were called or used. This is not the most accurate solution to this problem and will produce some false positives with identically named functions or negatives with complexly included headers - but for a quick pass this should give us the broad stroke usages. Ideally, we would want to build each project and see what is actually being linked during the compilation or do some more knowledgeable static analysis. But until then... results!



I was quite shocked by the lack of C++11 classes and functions being used. However, C++11 did introduce an awful lot of quite obscure parts and many variations - so this might not be as bad as it looks.


C++14 fared a lot better than C++11 which makes sense as C++14 is a revision which corrects a lot of the little things that C++11 missed and generally adds the little useful things that became obvious only after C++11 was finalised ( such as the std::rbegin/rend standalone functions).


I was honestly surprised to see as much usage of the C++17 standard as we did. Some of the functions that were used saw even higher usage than some C++11 functions that were used. Unsurprisingly the parts that were used have been the ones that you can see by the name are pretty simple and understandable - some of the more complex things in there havent shown up on any searches yet!


As I mentioned above, some of the standard things in C++11 are based on some popular parts of the Boost library. I am going to do a search for Boost usage next and see if there is significant crossover which would explain the delay in some projects making the switch as that would be an awful big risk to get very little gain!