Skip to content

Migrate from string view lite to std::string_view#495

Merged
Ghabry merged 6 commits into
EasyRPG:masterfrom
Ghabry:stringview
Mar 20, 2025
Merged

Migrate from string view lite to std::string_view#495
Ghabry merged 6 commits into
EasyRPG:masterfrom
Ghabry:stringview

Conversation

@Ghabry

@Ghabry Ghabry commented Mar 2, 2025

Copy link
Copy Markdown
Member

No description provided.

Ghabry added 2 commits March 2, 2025 19:37
This removes string_view lite as C++17 supports string views natively.

For convenience (and to make the replacement simpler) ToString helper function is kept.
Unfortunately C++17 has no starts/ends_with, helpers were added for this.
Fixes liblcf build when targetting C++20 or newer
@Ghabry Ghabry added the Building label Mar 2, 2025
@Ghabry Ghabry added this to the 0.8.1 milestone Mar 2, 2025
Ghabry added 2 commits March 10, 2025 14:22
Due to a different conversion API used (std::from_chars) conversion from hex strings is not supported anymore.
We do not use this feature so should be fine to remove it
Lack of support in clang and older gcc versions

@carstene1ns carstene1ns left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could have gotten away with a using StringView = std::string_view, but of course this is cleaner. :D

Comment thread src/inireader.cpp Outdated
@Ghabry

Ghabry commented Mar 20, 2025

Copy link
Copy Markdown
Member Author

Maybe we could have gotten away with a using StringView = std::string_view
but of course this is cleaner. :D

We would have :D. Besides start and endwith the interface is the same ;)

Ghabry added 2 commits March 20, 2025 17:37
Also slightly improves the performance because the amounts of fetches is reduced.
This will still fail to compile when starts_with etc. is used but at least gives some hint.
@Ghabry
Ghabry merged commit 1116de5 into EasyRPG:master Mar 20, 2025
@Ghabry
Ghabry deleted the stringview branch March 20, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants