r/cpp • • Sep 13 '26

C++20 modules support: 228 projects already available to be consumed

Hello everyone.

I checked arewemodulesyet.org, which I do from time to time.

I was very positively surprised bc a couple of months ago there were 109 projects with modules support.

Now it is 228 and some of the most popular are there: fmt, ftxui, nlohmann.json and others.

So I had to share it with the community.

119 Upvotes

39 comments sorted by

View all comments

8

u/positivcheg Sep 13 '26

I’m curious. What’s the use of fmt if STD has formatting?

39

u/marzer8789 toml++ Sep 13 '26

fmt can move much faster than the standard and has much better codegen IME

13

u/smdowney WG21, Text/Unicode SG, optional<T&> Sep 13 '26

Fmt has some capabilities that std doesn't and won't have.

Porting is just enough work, and risk, that it should be put off until you can pay attention, and not as a drive-by when you are doing something else.

Not much risk. About like any major version upgrade of a package.

But you are likely to get bit by something. If nothing else the operator<<() conversion that isn't in std and you have to write yourself is likely.

2

u/ReDr4gon5 Sep 13 '26

The main one that really surprised me is that format only supports char and wchar. So fmt is already way better in that regard.

1

u/smdowney WG21, Text/Unicode SG, optional<T&> Sep 15 '26

Which others does fmt support? The char{8,16,32}_t output is a nightmare of edge, corner, and really pointy end of the stick cases. That unfortunately look like they work just fine for a sensible already UTF system.

1

u/ReDr4gon5 Sep 15 '26

I think everything except char8_t where they say to just use char? I might be wrong though.

10

u/sweetno Sep 13 '26

It works with C++11.

9

u/_Noreturn Sep 13 '26 edited Sep 13 '26

it compiles much faster than the std version and has better error messages and runtime performance. also it had more features, and works in lower versions. if anything the std version sucks and should not be used

2

u/frankist Sep 13 '26

Why couldn't the compiler providers just copy/paste the fmt implementation?

2

u/TSP-FriendlyFire Sep 13 '26

fmt doesn't have to hold to the standard, its internal implementation and public API are allowed to change as needed. The standard, by contrast, needs to follow a pretty strict definition and all implementations also care about ABI stability which further reduces flexibility.

2

u/frankist Sep 13 '26

yes, but they could have just copied the existing pre-C++20 fmt implementation and not change it, maintaining ABI stability that way. After all, the std format was based on fmt.

4

u/TSP-FriendlyFire Sep 13 '26

It mostly was based on it, but the STL has very different requirements than a standalone library. Thing is, std::format was standardized in C++20, the last revision of the introductory paper was in mid 2019, and the majority of the API was set in stone before then.

That's over 7 years ago. fmt has changed quite a bit since then.

2

u/smdowney WG21, Text/Unicode SG, optional<T&> Sep 15 '26

We also, with great controversy and complaint, made breaking changes immediately after 20 shipped. It was constexpr checking of the format spec, but it still delayed ABI freeze for some standard libraries.

5

u/[deleted] Sep 13 '26

I think it was there before the standard one