|
2 | 2 | <feed xmlns="http://www.w3.org/2005/Atom"> |
3 | 3 | <title>cpprefjp - C++日本語リファレンス</title> |
4 | 4 | <link href="https://cpprefjp.github.io" /> |
5 | | - <updated>2026-04-06T09:05:20.050805</updated> |
6 | | - <id>557a45f4-f7f4-4fdf-a643-41a71bcd6921</id> |
| 5 | + <updated>2026-04-06T09:13:46.290561</updated> |
| 6 | + <id>06005be6-4405-46bc-a080-76e093299817</id> |
7 | 7 |
|
8 | 8 |
|
| 9 | + <entry> |
| 10 | + <title>共用体の特殊メンバ関数のトリビアル化 [P3074R7] -- インデントを修正</title> |
| 11 | + <link href="https://cpprefjp.github.io/lang/cpp26/trivial_unions.html"/> |
| 12 | + <id>321f8d140117e4fa3530ed309c7233aaa4598df3:lang/cpp26/trivial_unions.md</id> |
| 13 | + <updated>2026-04-06T18:09:22+09:00</updated> |
| 14 | + |
| 15 | + <summary type="html"><pre><code>diff --git a/lang/cpp26/trivial_unions.md b/lang/cpp26/trivial_unions.md |
| 16 | +index bca9abfe9..418c69d5a 100644 |
| 17 | +--- a/lang/cpp26/trivial_unions.md |
| 18 | ++++ b/lang/cpp26/trivial_unions.md |
| 19 | +@@ -15,25 +15,27 @@ C++26では、共用体 (`union`) のデフォルトコンストラクタとデ |
| 20 | + これにより、非トリビアルな型のメンバをもつ共用体を未初期化のストレージとして`constexpr`の文脈で使用できるようになる。 |
| 21 | + |
| 22 | + ```cpp |
| 23 | +-template &lt;typename T, size_t N&gt; |
| 24 | ++template &lt;typename T, std::size_t N&gt; |
| 25 | + struct FixedVector { |
| 26 | +- union { T storage[N]; }; |
| 27 | +- size_t size = 0; |
| 28 | ++ union { T storage[N]; }; |
| 29 | ++ std::size_t size = 0; |
| 30 | + |
| 31 | +- // C++23まで: unionのコンストラクタ/デストラクタが削除されるためコンパイルエラー |
| 32 | +- // C++26: OK。unionのコンストラクタ/デストラクタはトリビアル |
| 33 | +- constexpr FixedVector() = default; |
| 34 | ++ // C++23まで: unionのコンストラクタ/デストラクタが削除されるためコンパイルエラー |
| 35 | ++ // C++26: OK。unionのコンストラクタ/デストラクタはトリビアル |
| 36 | ++ constexpr FixedVector() = default; |
| 37 | + |
| 38 | +- constexpr ~FixedVector() { |
| 39 | +- std::destroy(storage, storage + size); |
| 40 | +- } |
| 41 | ++ constexpr ~FixedVector() { |
| 42 | ++ std::destroy(storage, storage + size); |
| 43 | ++ } |
| 44 | + |
| 45 | +- constexpr auto push_back(T const&amp; v) -&gt; void { |
| 46 | +- std::construct_at(storage + size, v); |
| 47 | +- ++size; |
| 48 | +- } |
| 49 | ++ constexpr auto push_back(T const&amp; v) -&gt; void { |
| 50 | ++ std::construct_at(storage + size, v); |
| 51 | ++ ++size; |
| 52 | ++ } |
| 53 | + }; |
| 54 | + ``` |
| 55 | ++* std::construct_at[link /reference/memory/construct_at.md] |
| 56 | ++* std::destroy[link /reference/memory/destroy.md] |
| 57 | + |
| 58 | + |
| 59 | + ## 仕様 |
| 60 | +</code></pre></summary> |
| 61 | + |
| 62 | + <author> |
| 63 | + <name>Akira Takahashi</name> |
| 64 | + <email>faithandbrave@gmail.com</email> |
| 65 | + </author> |
| 66 | + </entry> |
| 67 | + |
9 | 68 | <entry> |
10 | 69 | <title>コンパイラの実装状況 -- C++26: 「共用体の特殊メンバ関数のトリビアル化」を追加 (close #1417)</title> |
11 | 70 | <link href="https://cpprefjp.github.io/implementation-status.html"/> |
@@ -14004,29 +14063,6 @@ index 000000000..cbd2fe89e |
14004 | 14063 | + |
14005 | 14064 | +## 参照 |
14006 | 14065 | +- [P3533R2 constexpr virtual inheritance](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3533r2.html) |
14007 | | -</code></pre></summary> |
14008 | | - |
14009 | | - <author> |
14010 | | - <name>Akira Takahashi</name> |
14011 | | - <email>faithandbrave@gmail.com</email> |
14012 | | - </author> |
14013 | | - </entry> |
14014 | | - |
14015 | | - <entry> |
14016 | | - <title>main関数をグローバルモジュールに関連付けることを許可 [P3618R0] -- 関係ない参照文書を削除</title> |
14017 | | - <link href="https://cpprefjp.github.io/lang/cpp26/allow_attaching_main_to_the_global_module.html"/> |
14018 | | - <id>683ebcdeaef3c9e6e79b85bf0176929017739a97:lang/cpp26/allow_attaching_main_to_the_global_module.md</id> |
14019 | | - <updated>2026-04-06T09:53:12+09:00</updated> |
14020 | | - |
14021 | | - <summary type="html"><pre><code>diff --git a/lang/cpp26/allow_attaching_main_to_the_global_module.md b/lang/cpp26/allow_attaching_main_to_the_global_module.md |
14022 | | -index 72fc86986..8c1664e1d 100644 |
14023 | | ---- a/lang/cpp26/allow_attaching_main_to_the_global_module.md |
14024 | | -+++ b/lang/cpp26/allow_attaching_main_to_the_global_module.md |
14025 | | -@@ -80,4 +80,3 @@ P3422R1では、モジュール内で定義された`main()`関数を暗黙的 |
14026 | | - |
14027 | | - ## 参照 |
14028 | | - - [P3618R0 Allow attaching main to the global module](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3618r0.html) |
14029 | | --- [P3422R1 Fixing Modules for Test](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3422r1.html) |
14030 | 14066 | </code></pre></summary> |
14031 | 14067 |
|
14032 | 14068 | <author> |
|
0 commit comments