C++20移行 StaticStringをC++20で書き直す#2304
Merged
berryzplus merged 10 commits intosakura-editor:masterfrom Jan 12, 2026
Merged
Conversation
定義済みのAssignメソッドを使うよう修正
変更前: オーバーフロー時、クラッシュ。 変更後: オーバーフロー時、バッファに収まるよう切り詰め。
検知された結果を使うかどうかは利用側の裁量に任せる。
C++11 In-Class Initializerを使いコンストラクターをdefaultにする C++標準型との相互変換演算子群を定義する
初期値にNULLを指定できる意味はない。 explicitなので = "値" の書き方はできなくなった。
代入と文字数カウントにCランタイム関数を使うのをやめてconstexprにする。
EXPECT_THATスタイルに書き直す
|
berryzplus
commented
Jan 12, 2026
|
|
||
| constexpr Me& operator = (std::wstring_view rhs) noexcept { assign(rhs); return *this; } | ||
| constexpr Me& operator = (const std::wstring& rhs) noexcept { assign(rhs); return *this; } | ||
| constexpr Me& operator = (const std::filesystem::path& path) noexcept { assign(path.wstring()); return *this; } |
Contributor
Author
There was a problem hiding this comment.
う~む。
Suggested change
| constexpr Me& operator = (const std::filesystem::path& path) noexcept { assign(path.wstring()); return *this; } | |
| constexpr Me& operator = (const std::filesystem::path& path) noexcept { assign(path.native()); return *this; } |
| メソッド | 戻り値型 | 説明 |
|---|---|---|
std::filesystem::path :: wstring() |
std::wstring |
値を取得。(コピーする) |
std::filesystem::path :: native() |
std::wstring& |
値を取得。(コピーしない) |
「どっち?」とやるなら native() なんだけど。
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR対象
カテゴリ
PR の背景
サクラエディタには独自の文字列系クラスがたくさんあり、長年課題になっていました。
仕様・動作説明
StringBufferWをstd::span<WCHAR>のエイリアスに変更し、メンテナンスが必要なコードを減らします。本件も勝手にやります。
PR の影響範囲
テスト内容
関連 issue, PR
参考資料