Modularized Standard Library for Modules

Get a detailed introduction to the standard library for modules, supposedly a part of C++23.

We'll cover the following

Maybe you’d like to stop using Standard Library headers? Microsoft supports modules for all STL headers according to the C++ proposal P0541. Microsoft’s implementation gives you the first idea of how a modularized standard library for modules could look like. Here is what I have found in the post Using C++ Modules in Visual Studio 2017 from the Microsoft C++ team blog.

C++ modules in Visual Studio 2017

  • std.regex provides the content of the header <regex>
  • std.filesystem provides the content of the header <experimental/filesystem>
  • std.memory provides the content of the header <memory>
  • std.threading provides the contents of headers <atomic>, <condition_variable>, <future>, <mutex>, <shared_mutex>, and <thread>
  • std.core provides everything else in the C++ Standard Library

To use the Microsoft Standard Library modules, you have to specify the exception handling model (/EHsc) and the multithreading library (/MD). Additionally, you have to use the flags /std:c++latest and /experimental:module.

In the section on modules, I used the following module definition.

Get hands-on with 1200+ tech skills courses.