配列クラスを整備する - #2635
Closed
berryzplus wants to merge 23 commits into
Closed
Conversation
- static max_size() → static size() 配列サイズ(上限値)を返す。 - size() → count() 有効要素数(現在値)を返す。 - 新規 empty() 有効要素数が0かどうかを返す。
size() → count() の影響箇所を修正。 (empty()への移行分は除外。)
empty()への移行分を修正。
WCHAR[N]の代わりとして使い倒すべく改善する。
型の入出力をテンプレート特殊化で調整できるようにする。
不要になったstd::wstring::c_str()を外すだけのもの。
不要になったCNativeW::GetStringPtr()を外すだけのもの。
代入値の算出部分を関数化する特殊な変更を行ったもの。
NULLチェック漏れが起きうる変更。
Contributor
Author
Contributor
Author
|
全然違う話だった。 理由: 前提がひっくり返るので取り下げます。 |
x86ビルドができないため。
トップレベルのテンプレートをTに変えた影響でコンストラクタと衝突していた。 MinGWビルドのみでビルドエラー発生。
Contributor
Author
|
あとでコミットの再編をするとして、対策済み修正をあげておくことに。 |
Test Results1 358 tests +1 1 358 ✅ +1 7m 3s ⏱️ -25s Results for commit 49ec2dc. ± Comparison against base commit 80132bc. This pull request removes 5 and adds 6 tests. Note that renamed tests count towards both. |
Contributor
Author
|
ひっくり返った前提 前提: StaticVectorを生配列の代わりとして使いたい。 StaticVectorを生配列として扱ってたのはCRecentで、 どうまとめるかは考え中。 |
|
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 の背景
仕様・動作説明
「生配列の代わりに使えるクラスを整備する」の目的で始めた整備でしたが、
CNativeWも合わせて整備するのが妥当と思われたため一緒に含めることにしました。
最大の変更点はNULLの扱いです。
変更前) 文字列は LPCWSTR で受け取る。
変更後) 文字列は std::wstring_view で受け取る。
LPCWSTR はwchar_tポインタなので、NULL値になり得ます。
std::wstring_view は文字列参照なので、NULL値になりません。
旧来の実装では NULL を有効な無効値として扱うために色々苦労していました。
思い切って 「NULL値は無効」 に倒してしまうことで整理しやすくします。
今後は無効で、やったらクラッシュします。
「いい悪い」の判断は不可能と思うので、
本件も勝手にやります。
PR の影響範囲
テスト内容
関連 issue, PR
参考資料