-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrss.xml
More file actions
401 lines (366 loc) · 21.2 KB
/
rss.xml
File metadata and controls
401 lines (366 loc) · 21.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>cpprefjp - C++日本語リファレンス</title>
<link href="https://cpprefjp.github.io" />
<updated>2026-05-06T16:16:33.741913</updated>
<id>ce0c4aad-bcdd-4306-aea8-75cebf3e3d3b</id>
<entry>
<title>契約プログラミング [P2900R14] -- cpp26/contracts : P2900R14に合わせて修正</title>
<link href="https://cpprefjp.github.io/lang/cpp26/contracts.html"/>
<id>0e6380b40a6a6da7b4cb2e19b65a3905e5f32494:lang/cpp26/contracts.md</id>
<updated>2026-05-06T21:13:52+09:00</updated>
<summary type="html"><pre><code>diff --git a/lang/cpp26/contracts.md b/lang/cpp26/contracts.md
index d83c6728e..c060a6e51 100644
--- a/lang/cpp26/contracts.md
+++ b/lang/cpp26/contracts.md
@@ -76,13 +76,14 @@ public:
#### 事後条件(post)
関数の実行後に満たされているべき条件を指定する。
```cpp
-int increment(int x)
+int increment(const int x)
post(r: r == x + 1)
{
return x + 1;
}
```
ここでは、`increment`関数の戻り値が`x + 1`であることを事後条件として指定している。
+事後条件に関数引数を使用する場合、使用する引数は参照型か、`const`修飾型でなければならない。
`post`では、戻り値を`r`としてバインドし、条件式内で利用している。ここには、任意の変数名が使用できる。変数は定数(`const`)な左辺値参照である。
@@ -443,9 +444,9 @@ C++26では、契約プログラミングをサポートするために`&lt;contrac
```cpp
namespace std::contracts {
enum class assertion_kind {
- precondition, // 事前条件アサーション
- postcondition, // 事後条件アサーション
- assertion // アサーション文
+ pre, // 事前条件アサーション
+ post, // 事後条件アサーション
+ assert // アサーション文
};
}
```
@@ -485,9 +486,9 @@ namespace std::contracts {
public:
assertion_kind kind() const noexcept;
evaluation_semantic semantic() const noexcept;
- detection_mode detection() const noexcept;
+ contracts::detection_mode detection_mode() const noexcept;
source_location location() const noexcept;
- string_view comment() const noexcept;
+ const char* comment() const noexcept;
bool is_terminating() const noexcept;
exception_ptr evaluation_exception() const noexcept;
};
@@ -497,7 +498,7 @@ namespace std::contracts {
主なメンバ関数:
- `kind()`: 違反した契約アサーションの種類を返す
- `semantic()`: 使用された評価セマンティクスを返す
-- `detection()`: 違反の検出方法を返す
+- `detection_mode()`: 違反の検出方法を返す
- `location()`: 契約アサーションのソースロケーションを返す
- `comment()`: ベンダー固有のコメント文字列を返す
- `is_terminating()`: 違反後にプログラムが終了するかどうかを返す
@@ -559,7 +560,7 @@ void f(int x) pre(might_throw(x)); // 例外発生時は契約違反
#include &lt;iostream&gt;
// 事前条件と事後条件を持つ関数
-int safe_division(int numerator, int denominator)
+int safe_division(const int numerator, const int denominator)
pre(denominator != 0)
post(result: result * denominator == numerator)
{
@@ -595,7 +596,7 @@ public:
};
// ラムダ式での使用
-auto lambda_with_contract = [](int x)
+auto lambda_with_contract = [](const int x)
pre(x &gt; 0)
post(r: r &gt; x)
{
@@ -633,13 +634,13 @@ void handle_contract_violation(const std::contracts::contract_violation&amp; v) {
std::cerr &lt;&lt; &#34;契約違反が発生しました:\n&#34;;
std::cerr &lt;&lt; &#34; 種類: &#34;;
switch (v.kind()) {
- case std::contracts::assertion_kind::precondition:
+ case std::contracts::assertion_kind::pre:
std::cerr &lt;&lt; &#34;事前条件\n&#34;;
break;
- case std::contracts::assertion_kind::postcondition:
+ case std::contracts::assertion_kind::post:
std::cerr &lt;&lt; &#34;事後条件\n&#34;;
break;
- case std::contracts::assertion_kind::assertion:
+ case std::contracts::assertion_kind::assert:
std::cerr &lt;&lt; &#34;アサーション\n&#34;;
break;
}
@@ -656,7 +657,7 @@ void handle_contract_violation(const std::contracts::contract_violation&amp; v) {
std::contracts::invoke_default_contract_violation_handler(v);
}
-int process(int x)
+int process(const int x)
pre(x &gt; 0)
post(r: r &gt; x)
{
@@ -679,7 +680,7 @@ int main() {
#include &lt;vector&gt;
template&lt;std::integral T&gt;
-T increment(T value)
+T increment(const T value)
pre(value &lt; std::numeric_limits&lt;T&gt;::max())
post(result: result == value + 1)
{
</code></pre></summary>
<author>
<name>Raclamusi</name>
<email>raclamusi@gmail.com</email>
</author>
</entry>
<entry>
<title>共用体の特殊メンバ関数のトリビアル化 [P3074R7] -- サンプルコードの include 不足のエラーを修正</title>
<link href="https://cpprefjp.github.io/lang/cpp26/trivial_unions.html"/>
<id>5786bf010c662599443cf6db94ebdf57550cb611:lang/cpp26/trivial_unions.md</id>
<updated>2026-05-06T20:15:04+09:00</updated>
<summary type="html"><pre><code>diff --git a/lang/cpp26/trivial_unions.md b/lang/cpp26/trivial_unions.md
index 418c69d5a..4fb99137a 100644
--- a/lang/cpp26/trivial_unions.md
+++ b/lang/cpp26/trivial_unions.md
@@ -81,7 +81,7 @@ union U6 { std::string s; int n = 0; };
```cpp example
#include &lt;cassert&gt;
-#include &lt;new&gt;
+#include &lt;memory&gt; // std::construct_at()
constexpr int f() {
union { int s[4]; };
</code></pre></summary>
<author>
<name>Raclamusi</name>
<email>raclamusi@gmail.com</email>
</author>
</entry>
<entry>
<title>assign -- improve the wording in vector::assign().</title>
<link href="https://cpprefjp.github.io/reference/vector/vector/assign.html"/>
<id>334d0e58bdfb868ca4f2b9a34c69c1a65f9c529b:reference/vector/vector/assign.md</id>
<updated>2026-05-04T11:24:57+09:00</updated>
<summary type="html"><pre><code>diff --git a/reference/vector/vector/assign.md b/reference/vector/vector/assign.md
index 38cecc062..0e644ff1a 100644
--- a/reference/vector/vector/assign.md
+++ b/reference/vector/vector/assign.md
@@ -27,7 +27,7 @@ constexpr void assign(initializer_list&lt;T&gt; il); // (3) C++20
## 要件
-- (1) : 型`T`は`*first`から`X`に対してEmplaceConstructibleでなければならない。イテレータがForward iterators の要件を満たさない場合、型`T`は`X`に対してMoveInsertableでなければならない。`[first, last)`の範囲のそれぞれのイテレータは1回だけ間接参照される。`first`, `last`は自身のイテレータであってはならない。
+- (1) : 型`T`が`*first`から`vector`コンテナへの`EmplaceConstructible`であること。`InputIterator`が前方向イテレータの要件を満たさない場合、型`T`は`vector`コンテナに対してMoveInsertableであること。`[first, last)`の範囲のそれぞれのイテレータは1回だけ間接参照される。`first`, `last`は自身のイテレータであってはならない。
- (2) : `t`は`*this`の要素への参照であってはならない。
</code></pre></summary>
<author>
<name>suomesta</name>
<email>shawn316michaels@gmail.com</email>
</author>
</entry>
<entry>
<title>__STDC_ENDIAN_BIG__ -- 太字になっていたタイトルをエスケープ</title>
<link href="https://cpprefjp.github.io/reference/stdbit.h/stdc_endian_big.html"/>
<id>a1923fe1721565e4d3a9cc1ffce5edd4595a24e3:reference/stdbit.h/stdc_endian_big.md</id>
<updated>2026-05-04T10:52:27+09:00</updated>
<content type="html"><div class="identifier-type">macro</div><div class="header">&lt;stdbit.h&gt;</div><h1 itemprop="name"><span class="token">__STDC_ENDIAN_BIG__</span><span class="cpp cpp26" title="C++26で追加">(C++26)</span></h1>
<div itemprop="articleBody"><h2>概要</h2>
<p>ビッグエンディアンを表す定数マクロ。</p>
<p>C言語の<code>&lt;stdbit.h&gt;</code>で定義される定数であり、C++においてはC互換性のために提供される。</p>
<h2>備考</h2>
<ul>
<li>C言語では<code>&lt;stdbit.h&gt;</code>で定義される定数マクロである</li>
<li>C++では、<code><a href="../bit/endian.html">std::endian::big</a></code>が対応する機能である</li>
</ul>
<h2>バージョン</h2>
<h3>言語</h3>
<ul>
<li>C++26</li>
</ul>
<h3>処理系</h3>
<ul>
<li><a href="../../implementation.html#clang">Clang</a>: 21 <span aria-label="検証済" role="img" title="検証済">✅</span></li>
<li><a href="../../implementation.html#gcc">GCC</a>: 15 <span aria-label="検証済" role="img" title="検証済">✅</span></li>
<li><a href="../../implementation.html#visual_cpp">Visual C++</a>: 2026 Update 2 <span aria-label="未実装" role="img" title="未実装">❌</span></li>
</ul>
<h2>関連項目</h2>
<ul>
<li><code><a href="../bit/endian.html">std::endian</a></code> - C++標準のエンディアン列挙型</li>
</ul>
<h2>参照</h2>
<ul>
<li><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3022.htm" target="_blank">N3022 Modern Bit Utilities</a></li>
<li><a href="https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3370r1.html" target="_blank">P3370R1 Add new C headers as C++ headers</a></li>
</ul></div></content>
<author>
<name>Raclamusi</name>
<email>raclamusi@gmail.com</email>
</author>
</entry>
<entry>
<title>__STDC_ENDIAN_LITTLE__ -- 太字になっていたタイトルをエスケープ</title>
<link href="https://cpprefjp.github.io/reference/stdbit.h/stdc_endian_little.html"/>
<id>a1923fe1721565e4d3a9cc1ffce5edd4595a24e3:reference/stdbit.h/stdc_endian_little.md</id>
<updated>2026-05-04T10:52:27+09:00</updated>
<content type="html"><div class="identifier-type">macro</div><div class="header">&lt;stdbit.h&gt;</div><h1 itemprop="name"><span class="token">__STDC_ENDIAN_LITTLE__</span><span class="cpp cpp26" title="C++26で追加">(C++26)</span></h1>
<div itemprop="articleBody"><h2>概要</h2>
<p>リトルエンディアンを表す定数マクロ。</p>
<p>C言語の<code>&lt;stdbit.h&gt;</code>で定義される定数であり、C++においてはC互換性のために提供される。</p>
<h2>備考</h2>
<ul>
<li>C言語では<code>&lt;stdbit.h&gt;</code>で定義される定数マクロである</li>
<li>C++では、<code><a href="../bit/endian.html">std::endian::little</a></code>が対応する機能である</li>
</ul>
<h2>バージョン</h2>
<h3>言語</h3>
<ul>
<li>C++26</li>
</ul>
<h3>処理系</h3>
<ul>
<li><a href="../../implementation.html#clang">Clang</a>: 21 <span aria-label="検証済" role="img" title="検証済">✅</span></li>
<li><a href="../../implementation.html#gcc">GCC</a>: 15 <span aria-label="検証済" role="img" title="検証済">✅</span></li>
<li><a href="../../implementation.html#visual_cpp">Visual C++</a>: 2026 Update 2 <span aria-label="未実装" role="img" title="未実装">❌</span></li>
</ul>
<h2>関連項目</h2>
<ul>
<li><code><a href="../bit/endian.html">std::endian</a></code> - C++標準のエンディアン列挙型</li>
</ul>
<h2>参照</h2>
<ul>
<li><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3022.htm" target="_blank">N3022 Modern Bit Utilities</a></li>
<li><a href="https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3370r1.html" target="_blank">P3370R1 Add new C headers as C++ headers</a></li>
</ul></div></content>
<author>
<name>Raclamusi</name>
<email>raclamusi@gmail.com</email>
</author>
</entry>
<entry>
<title>__STDC_ENDIAN_NATIVE__ -- 太字になっていたタイトルをエスケープ</title>
<link href="https://cpprefjp.github.io/reference/stdbit.h/stdc_endian_native.html"/>
<id>a1923fe1721565e4d3a9cc1ffce5edd4595a24e3:reference/stdbit.h/stdc_endian_native.md</id>
<updated>2026-05-04T10:52:27+09:00</updated>
<content type="html"><div class="identifier-type">macro</div><div class="header">&lt;stdbit.h&gt;</div><h1 itemprop="name"><span class="token">__STDC_ENDIAN_NATIVE__</span><span class="cpp cpp26" title="C++26で追加">(C++26)</span></h1>
<div itemprop="articleBody"><h2>概要</h2>
<p>実行環境のエンディアンを表す定数マクロ。</p>
<p>C言語の<code>&lt;stdbit.h&gt;</code>で定義される定数であり、C++においてはC互換性のために提供される。</p>
<h2>備考</h2>
<ul>
<li>C言語では<code>&lt;stdbit.h&gt;</code>で定義される定数マクロである</li>
<li>C++では、<code><a href="../bit/endian.html">std::endian::native</a></code>が対応する機能である</li>
</ul>
<h2>バージョン</h2>
<h3>言語</h3>
<ul>
<li>C++26</li>
</ul>
<h3>処理系</h3>
<ul>
<li><a href="../../implementation.html#clang">Clang</a>: 21 <span aria-label="検証済" role="img" title="検証済">✅</span></li>
<li><a href="../../implementation.html#gcc">GCC</a>: 15 <span aria-label="検証済" role="img" title="検証済">✅</span></li>
<li><a href="../../implementation.html#visual_cpp">Visual C++</a>: 2026 Update 2 <span aria-label="未実装" role="img" title="未実装">❌</span></li>
</ul>
<h2>関連項目</h2>
<ul>
<li><code><a href="../bit/endian.html">std::endian</a></code> - C++標準のエンディアン列挙型</li>
</ul>
<h2>参照</h2>
<ul>
<li><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3022.htm" target="_blank">N3022 Modern Bit Utilities</a></li>
<li><a href="https://open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3370r1.html" target="_blank">P3370R1 Add new C headers as C++ headers</a></li>
</ul></div></content>
<author>
<name>Raclamusi</name>
<email>raclamusi@gmail.com</email>
</author>
</entry>
<entry>
<title>let_value -- execution/let_value: fix indent</title>
<link href="https://cpprefjp.github.io/reference/execution/execution/let_value.html"/>
<id>3e90df48d95ebe8caac3ec51fa319c60ea0ab9f5:reference/execution/execution/let_value.md</id>
<updated>2026-05-03T22:31:25+09:00</updated>
<summary type="html"><pre><code>diff --git a/reference/execution/execution/let_value.md b/reference/execution/execution/let_value.md
index a28f733a6..b87527df4 100644
--- a/reference/execution/execution/let_value.md
+++ b/reference/execution/execution/let_value.md
@@ -175,39 +175,39 @@ return JOIN-ENV(let-env(child), FWD-ENV(env));
```cpp
template&lt;class Cpo, class Sndr, class Fn, class Rcvr, class ArgsVariant,
class OpsVariant&gt;
- struct let-state {
- using env_t = decltype(let-env(declval&lt;Sndr&gt;())); // exposition only
- Fn fn; // exposition only
- env_t env; // exposition only
- ArgsVariant args; // exposition only
- OpsVariant ops; // exposition only
-
- template&lt;class Tag, class... Ts&gt;
- constexpr void impl(Rcvr&amp; rcvr, Tag tag, Ts&amp;&amp;... ts) noexcept
- { // exposition only
- using args_t = decayed-tuple&lt;Ts...&gt;;
- using receiver_type = receiver2&lt;Rcvr, env_t&gt;;
- using sender_type = apply_result_t&lt;Fn, args_t&amp;&gt;;
- if constexpr (is_same_v&lt;Tag, Cpo&gt;) {
- try {
- auto&amp; tuple = args.template emplace&lt;args_t&gt;(std::forward&lt;Ts&gt;(ts)...);
- ops.template emplace&lt;monostate&gt;();
- auto&amp;&amp; sndr = apply(std::move(fn), tuple);
- using op_t = connect_result_t&lt;sender_type, receiver_type&gt;;
- auto mkop2 = [&amp;] {
- return connect(std::forward&lt;sender_type&gt;(sndr),
- receiver_type{rcvr, env});
- };
- auto&amp; op = ops.template emplace&lt;op_t&gt;(emplace-from{mkop2});
- start(op);
- } catch (...) {
- constexpr bool nothrow =
- is_nothrow_constructible_v&lt;args_t, Ts...&gt; &amp;&amp;
- is_nothrow_applicable_v&lt;Fn, args_t&amp;&gt; &amp;&amp;
- noexcept(
- connect(
- declval&lt;sender_type&gt;(),
- receiver_type{rcvr, env}));
+struct let-state {
+ using env_t = decltype(let-env(declval&lt;Sndr&gt;())); // exposition only
+ Fn fn; // exposition only
+ env_t env; // exposition only
+ ArgsVariant args; // exposition only
+ OpsVariant ops; // exposition only
+
+ template&lt;class Tag, class... Ts&gt;
+ constexpr void impl(Rcvr&amp; rcvr, Tag tag, Ts&amp;&amp;... ts) noexcept
+ { // exposition only
+ using args_t = decayed-tuple&lt;Ts...&gt;;
+ using receiver_type = receiver2&lt;Rcvr, env_t&gt;;
+ using sender_type = apply_result_t&lt;Fn, args_t&amp;&gt;;
+ if constexpr (is_same_v&lt;Tag, Cpo&gt;) {
+ try {
+ auto&amp; tuple = args.template emplace&lt;args_t&gt;(std::forward&lt;Ts&gt;(ts)...);
+ ops.template emplace&lt;monostate&gt;();
+ auto&amp;&amp; sndr = apply(std::move(fn), tuple);
+ using op_t = connect_result_t&lt;sender_type, receiver_type&gt;;
+ auto mkop2 = [&amp;] {
+ return connect(std::forward&lt;sender_type&gt;(sndr),
+ receiver_type{rcvr, env});
+ };
+ auto&amp; op = ops.template emplace&lt;op_t&gt;(emplace-from{mkop2});
+ start(op);
+ } catch (...) {
+ constexpr bool nothrow =
+ is_nothrow_constructible_v&lt;args_t, Ts...&gt; &amp;&amp;
+ is_nothrow_applicable_v&lt;Fn, args_t&amp;&gt; &amp;&amp;
+ noexcept(
+ connect(
+ declval&lt;sender_type&gt;(),
+ receiver_type{rcvr, env}));
if constexpr (!nothrow) {
set_error(std::move(rcvr), current_exception());
}
</code></pre></summary>
<author>
<name>yoh</name>
<email>kawasaki.liamg@gmail.com</email>
</author>
</entry>
</feed>