Skip to content

C++26リフレクションに対応#1607

Open
faithandbrave wants to merge 57 commits intomasterfrom
cpp26_reflection
Open

C++26リフレクションに対応#1607
faithandbrave wants to merge 57 commits intomasterfrom
cpp26_reflection

Conversation

@faithandbrave
Copy link
Copy Markdown
Member

一通り軽くチェックしたくらいなので、作業漏れチェックなどしてからマージします。

@faithandbrave
Copy link
Copy Markdown
Member Author

まだ大量に抜けがありそう

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

プレビュー (HTML) (更新時刻: 2026-05-08 11:11:27 JST)

  • Commit: ff9af99
  • プレビューの生成には時間がかかります (3~5分)。進捗状況はこちらをご確認ください。

変更記事一覧

265件の記事が変更されました。多いため一部を表示しています。完全なリストについてはこちらをご参照ください。

(ファイル一覧)

※ソース (.md) に直接変更のあった記事を列挙しています。グローバル修飾や変換規則の変更による変化は考慮していません。

@faithandbrave
Copy link
Copy Markdown
Member Author

これの取り消しに対応しないといけない

Comment thread lang/cpp26/reflection.md Outdated
Comment thread lang/cpp26/reflection.md Outdated
Comment thread lang/cpp26/reflection.md Outdated
Comment thread lang/cpp26/reflection.md Outdated
Comment thread lang/cpp26/reflection.md Outdated
Comment thread lang/cpp26/reflection.md
Comment thread lang/cpp26/reflection.md Outdated
Comment thread lang/cpp26/reflection.md Outdated
Comment thread lang/cpp26/reflection.md Outdated
Comment thread reference/meta/annotations_of.md Outdated
Comment thread reference/meta/annotations_of_with_type.md Outdated
Comment thread reference/meta/is_override.md Outdated
Comment thread reference/meta/access_context/current.md Outdated
Comment thread reference/meta/access_context/designating_class.md Outdated
Comment thread reference/meta/access_context/scope.md Outdated
Comment thread reference/meta/access_context/unchecked.md Outdated
Comment thread reference/meta/access_context/unprivileged.md Outdated
Comment thread reference/meta/access_context/via.md Outdated
Comment thread lang/cpp26/reflection.md Outdated
Comment thread lang/cpp26/reflection.md Outdated
@faithandbrave
Copy link
Copy Markdown
Member Author

@yohhoy @Raclamusi
たくさん指摘いただいてありがとうございます。
まだ直すところ、書くところが大量にあってぜんぜん追いついてない状況です。
セルフチェックまでおわったらレビュー期間をとりますので、一旦置いておいていただければと思います。

faithandbrave and others added 8 commits April 11, 2026 10:53
…必要がある

Co-authored-by: Raclamusi <61970673+Raclamusi@users.noreply.github.com>
Co-authored-by: Raclamusi <61970673+Raclamusi@users.noreply.github.com>
Co-authored-by: Raclamusi <61970673+Raclamusi@users.noreply.github.com>
Co-authored-by: Raclamusi <61970673+Raclamusi@users.noreply.github.com>
Co-authored-by: Raclamusi <61970673+Raclamusi@users.noreply.github.com>
Co-authored-by: Raclamusi <61970673+Raclamusi@users.noreply.github.com>
Co-authored-by: Raclamusi <61970673+Raclamusi@users.noreply.github.com>
@faithandbrave
Copy link
Copy Markdown
Member Author

一旦、コミットを整理しつつ @Raclamusi さんの変更を取り込みました

@faithandbrave
Copy link
Copy Markdown
Member Author

ページ数としては、一旦過不足がなくなったはず。

@faithandbrave
Copy link
Copy Markdown
Member Author

TODO : ハッシュ計算の例を書く。hash_combineはないので、とりあえずXORで

@faithandbrave
Copy link
Copy Markdown
Member Author

いただいた指摘には一旦対応しましたが、reflection.mdでの解説を見直す必要があります。

@faithandbrave
Copy link
Copy Markdown
Member Author

対応したので、このあと一旦セルフレビュー

@faithandbrave
Copy link
Copy Markdown
Member Author

直しました〜

Comment thread reference/meta/is_defaulted.md Outdated
Comment thread reference/meta/is_deleted.md Outdated
@faithandbrave
Copy link
Copy Markdown
Member Author

GCC 16で使えるようなので、動作検証します

@faithandbrave
Copy link
Copy Markdown
Member Author

GCC 16ですべて動作検証しました。一部未実装もあったので、[mark noimpl]をつけてあります。

@faithandbrave
Copy link
Copy Markdown
Member Author

std::meta::type_underlying_type()関数はstd::meta::underlying_type()に名称変更されていたので (Working Draftに入るときに変わった?)、ページをそのように変更してあります。

@Raclamusi
Copy link
Copy Markdown
Member

Raclamusi commented Apr 30, 2026

std::meta::has_ellipsis_parameter()std::meta::is_vararg_function() に名称変更されたようです。
cplusplus/papers#2728


std::meta の関数が増えているようです。
cplusplus/papers#2401

consteval info current_function();
consteval info current_class();
consteval info current_namespace();

consteval bool is_applicable_type(info fn, info tuple);
consteval bool is_nothrow_applicable_type(info fn, info tuple);
consteval info apply_result(info fn, info tuple);

std::is_structural<T>std::meta::is_structural_type() というのが増えているようです。
cplusplus/papers#2460


std::is_consteval_only<T> および std::meta::is_consteval_only_type() が削除されたようです。
https://cplusplus.github.io/LWG/issue4555

@faithandbrave
Copy link
Copy Markdown
Member Author

@Raclamusi
対応しました〜

@faithandbrave
Copy link
Copy Markdown
Member Author

GCCのコンパイルオプションを記載しました

Comment thread reference/meta/exception.md
Comment thread reference/meta/define_static_array.md Outdated
Comment thread reference/meta/reflect_constant.md Outdated
Comment thread reference/meta/annotations_of.md Outdated
Comment thread reference/meta/annotations_of.md Outdated
faithandbrave and others added 3 commits May 8, 2026 11:01
Copy link
Copy Markdown
Member

@Raclamusi Raclamusi left a comment

Choose a reason for hiding this comment

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

問題ないと思います!

Comment thread lang/cpp26/reflection.md
* std::meta::access_context[link /reference/meta/access_context.md]
* unchecked[link /reference/meta/access_context/unchecked.md]

非メンバ関数(名前空間スコープの関数)の場合、オーバーロード集合そのものをリフレクションとして取得する手段は存在しない。そのため、非メンバ関数でオーバーロード集合から特定のオーバーロードを扱いたい場合は、関数ポインタ型にキャストして型を明示するなどの手段が必要となる。汎用的に関数のオーバーロードをリフレクションで扱いたい場合は、クラスのメンバ関数として定義することが必要になる。
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.

最後の「クラスのメンバ関数として定義することが必要」のイメージが掴めませんでした。直前サンプルコードのように、「クラスSのメンバ関数一覧から明示的に選択する必要がある」というニュアンスでしょうか?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

そうですー

Copy link
Copy Markdown
Member

@yohhoy yohhoy May 8, 2026

Choose a reason for hiding this comment

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

当該文節を読み直して、ここでの意図を理解できました...

  • 名前空間スコープ(非メンバ関数)で関数オーバーロードを定義:関数ポインタ型へのキャスト等で関数を特定する必要がある
  • クラススコープで関数オーバーロードを定義:所属クラスから meta::member_of 一覧取得して選択する方式が取れる

技術的には 「名前空間 ^^NS から関数オーバーロードに含まれる関数一覧から(頑張って)特定関数のリフレクションを取得」も出来はしますね。読み進める上で "小さな引っ掛かり"があった程度ですから、現行説明のままでも問題無いとは思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants