-
Notifications
You must be signed in to change notification settings - Fork 175
C++11 range-based for loop 対応 (CProfile) #2124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++11 range-based for loop 対応 (CProfile) #2124
Conversation
berryzplus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応ありがとうございます。
| for(const auto& iter : m_ProfileData) { | ||
| MYTRACE( L"\n■strSectionName=%ls", iter.strSectionName.c_str() ); | ||
| for(const auto& mapiter : iter.mapEntries) { | ||
| MYTRACE( L"\"%ls\" = \"%ls\"\n", mapiter.first.c_str(), mapiter.second.c_str() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
引っかかる余地があるのはここだけと思いますが、C++11対応をうたっているので問題なしと思います。
(「mapのkey-value列挙にはC++17の構造化束縛を使おう」の指摘はあり得る。)
| vecLine.push_back( LTEXT("") ); | ||
| } | ||
| for(auto iter = m_ProfileData.cbegin(); iter != m_ProfileData.cend(); iter++ ) { | ||
| for(const auto& iter : m_ProfileData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
変更後はこの変数は iterator ではないと思うのでちょっと変数名に違和感があります。まぁ細かい事を言い出すときりが無いですが。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
マジメにネーミングすると seciton ですね。
プロファイル
┗セクション1
┣キー1 = 値1
┣キー2 = 値2
┗キー3 = 値3
という構造。セクションは配列(vector)、セクション内のkey-valueはマップ(map)なので
線形イテレーターの iter 、マップイテレーターの mapIter という変数名にしたものと思われます。
beru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
問題無いと思います。
PR対象
カテゴリ
PR の背景
C++11 から range-based for loop が使用できるので、簡潔に記述できる。
仕様・動作説明
PR の影響範囲
影響なし。
テスト内容
デバッガの引数に "-NOWIN" を追加
タスクトレイから、サクラエディタの全終了を選択
関連 issue, PR
#1733
#416
参考資料
https://cpprefjp.github.io/lang/cpp11/range_based_for.html