STL
STL copied to clipboard
Optimize `println()` overloads added in P3142R0
Fixes #4630.
- Add a function
__std_print_newline_only_to_unicode_consoleto the import library to avoid potential branches aroundWriteConsoleW. - Use
sputcfor non-Unicode new line printing forostreamto reduce potential branches. - Use
fputcfor non-Unicode new line printing forFILE*as the function seems to be the simplest for the purpose in UCRT.
I've pushed a conflict-free merge with main to pick up the 17.12p2 / Clang 18 toolset update. (This isn't usually critical, but it was a big reformatting PR.) No clang-format regeneration was necessary.
Thanks! :heart_eyes_cat: I pushed a conflict-free merge with main followed by several refactorings, shrinking the diff from +181 -2 to +115 -10. Originally, this PR looked like it was adding significant complexity, but now I like where it ended up. I'd still like @CaseyCarter to look at this.
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.
Thanks for figuring out the surprisingly complicated logic needed to make these functions fast! :rocket: :heart_eyes_cat: :green_heart: