Skip to content

feat(integer_sequence): integer_sequenceに関する適格要件と備考を追加#1610

Merged
teruyamato0731 merged 2 commits intomasterfrom
feat/integer_sequence-mandating
Apr 13, 2026
Merged

feat(integer_sequence): integer_sequenceに関する適格要件と備考を追加#1610
teruyamato0731 merged 2 commits intomasterfrom
feat/integer_sequence-mandating

Conversation

@teruyamato0731
Copy link
Copy Markdown
Contributor

@teruyamato0731 teruyamato0731 commented Apr 12, 2026

概要

std::integer_sequence のテンプレートパラメータ T に関する制約(適格要件)について、C++17からC++20にかけての仕様変更(Mandates: への厳格化)を追記します。

変更の背景

C++20における標準ライブラリの要件記述の見直し(P1460R1)により、T が整数型であることの要件が shall be から Mandates に変更されました。

C++17(N4659)

T shall be an integer type.

C++20(N4861)

Mandates: T is an integer type.

これにより、C++20以降では T に整数型以外を渡した場合にコンパイラが確実に診断メッセージ(エラー)を出すこと(static_assert 等によるハードエラー)が規格で要求されるようになりました。
実際のコンパイラ(GCC等)でも、C++20モードから static_assert(is_integral_v<T>); が発動するように実装が変更されているため、ユーザー向けの注意喚起として備考に追記しました。

GCCによる実装:

#if __cplusplus >= 202002L
      static_assert(is_integral_v<_Tp>);
#endif

参考

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 12, 2026

プレビュー (HTML) (更新時刻: 2026-04-13 12:18:53 JST)

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

変更記事一覧

1件の記事が変更されました。

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

@faithandbrave
Copy link
Copy Markdown
Member

ありがとうございます。
Mandatesは、テンプレートパラメータ制約 (Constraints) ではなく「適格要件」でお願いします〜
https://github.com/cpprefjp/site/blob/master/start_editing/function_template_page.md

@teruyamato0731
Copy link
Copy Markdown
Contributor Author

@faithandbrave レビューありがとうございます。
テンプレートパラメータ制約 -> 適格要件に修正しました。
その他問題がなさそうならマージさせてもらおうかと思います。

@faithandbrave
Copy link
Copy Markdown
Member

対応ありがとうございます!こちらで問題ないかと思います〜

@teruyamato0731 teruyamato0731 changed the title feat(integer_sequence): integer_sequenceに関するテンプレートパラメータ制約と備考を追加 feat(integer_sequence): integer_sequenceに関する適格要件と備考を追加 Apr 13, 2026
@teruyamato0731 teruyamato0731 merged commit 0c7655d into master Apr 13, 2026
20 checks passed
@teruyamato0731 teruyamato0731 deleted the feat/integer_sequence-mandating branch April 13, 2026 03:56
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.

2 participants