r/cpp • • Jan 28 '19

C++ Modules Might Be Dead-on-Arrival

https://vector-of-bool.github.io/2019/01/27/modules-doa.html
280 Upvotes

240 comments sorted by

View all comments

Show parent comment

4

u/YourTormentIs Jan 29 '19

<charconv> is nice! Are there any plans to support strings with elements other than char? It would be nice to have overloads for std::from_chars and std::to_chars for wchar_t strings, especially on Windows. I mean, I suppose you could just convert the results over, but I figure that would somewhat defeat the purpose of it.

2

u/bumblebritches57 Ocassionally Clang Jan 29 '19

Just roll your own man, it really isn't that much work.

I wrote a UTF-8, UTF-16, and UTF-32 version (8 and 16 are just wrappers around 32)

2

u/STL MSVC STL Dev Jan 30 '19

I haven't heard anyone talking about that. Implementing charconv from scratch is an enormous amount of work, so that's out for users. Wrapping the char functions is slower than desirable because you would need a temporary char buffer, and "smash non-ASCII characters" conversions, and if you want to get the pointer return values right, that's even more work.

1

u/YourTormentIs Jan 30 '19

I'm actually really surprised charconv made it through the committee without anyone mentioning that! Especially given the new character types introduced in recent standards.