beyond-all-reason / pr-downloader

console downloader for spring maps/games written in c++
GNU General Public License v2.0
0 stars 8 forks source link

Support for C++ 20 compilation #55

Closed bigbluejay9 closed 8 months ago

bigbluejay9 commented 8 months ago

C++ 20 introduces a std::u8string type which is not implicitly coercable to a std::string. Calls to std::filesystem::path::u8string() are thus no longer compatible with the std::string type.

This change forces an explicit cast from std::u8string to std::string in C++ 20 compilations. In C++ 17 compilations, the cast is from std::string to std::string (a noop).

Prompted by looking into integrating https://github.com/hanickadot/compile-time-regular-expressions into spring (which forces dependents to C++20 compilation unless told not to), https://github.com/beyond-all-reason/spring/issues/1181.

p2004a commented 8 months ago

For C++20 we need to also stop using deprecated std::filesystem::u8path, but making it compile at all is a good start.