Skip to content

Commit b1203c4

Browse files
author
cpprefjp-autoupdate
committed
update automatically
1 parent 22d6469 commit b1203c4

File tree

4 files changed

+104
-41
lines changed

4 files changed

+104
-41
lines changed

reference/chrono/make24.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ <h2>例</h2>
239239
<span class="n"><a href="https://cpprefjp.github.io/reference/cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">12h</a></span><span class="p">,</span> <span class="nb">false</span><span class="p">)</span> <span class="o">==</span> <span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">0h</a></span><span class="p">);</span>
240240

241241
<span class="n"><a href="https://cpprefjp.github.io/reference/cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">12h</a></span><span class="p">,</span> <span class="nb">true</span><span class="p">)</span> <span class="o">==</span> <span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">12h</a></span><span class="p">);</span>
242-
<span class="n"><a href="https://cpprefjp.github.io/reference/cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">1h</a></span><span class="p">,</span> <span class="nb">true</span><span class="p">)</span> <span class="o">==</span> <span class="mf">1F</span><span class="n">hineutHFCYHybtVyOjQqmhpoNOddAiG</span><span class="p">);</span>
242+
<span class="n"><a href="https://cpprefjp.github.io/reference/cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">1h</a></span><span class="p">,</span> <span class="nb">true</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">3h</a></span><span class="p">);</span>
243243
<span class="n"><a href="https://cpprefjp.github.io/reference/cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">3h</a></span><span class="p">,</span> <span class="nb">true</span><span class="p">)</span> <span class="o">==</span> <span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">15h</a></span><span class="p">);</span>
244244
<span class="n"><a href="https://cpprefjp.github.io/reference/cassert/assert.html">assert</a></span><span class="p">(</span><span class="n"><span style="color:#ff0000">chrono::make24</span></span><span class="p">(</span><span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">11h</a></span><span class="p">,</span> <span class="nb">true</span><span class="p">)</span> <span class="o">==</span> <span class="n"><a href="https://cpprefjp.github.io/reference/chrono/duration/op_h.html">23h</a></span><span class="p">);</span>
245245
<span class="p">}</span>

reference/future/promise/op_destructor.html

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
</head>
7070
<body>
71-
<header data-kunai-mdinfo="{&#34;meta&#34;: {&#34;header&#34;: [&#34;future&#34;], &#34;namespace&#34;: [&#34;std&#34;], &#34;class&#34;: [&#34;promise&#34;], &#34;id-type&#34;: [&#34;function&#34;], &#34;cpp&#34;: [&#34;cpp11&#34;]}, &#34;sources&#34;: [], &#34;page_id&#34;: [&#34;reference&#34;, &#34;future&#34;, &#34;promise&#34;, &#34;op_destructor&#34;]}">
71+
<header data-kunai-mdinfo="{&#34;meta&#34;: {&#34;header&#34;: [&#34;future&#34;], &#34;namespace&#34;: [&#34;std&#34;], &#34;class&#34;: [&#34;promise&#34;], &#34;id-type&#34;: [&#34;function&#34;], &#34;cpp&#34;: [&#34;cpp11&#34;]}, &#34;sources&#34;: [{&#34;id&#34;: &#34;33d4c7391b53beb4e3943168653ec0b931251583&#34;, &#34;source&#34;: &#34;#include &lt;iostream&gt;\n#include &lt;future&gt;\n#include &lt;thread&gt;\n#include &lt;utility&gt;\n\nvoid calc(std::promise&lt;int&gt; p)\n{\n // \u901a\u5e38\u884c\u3046 p.set_value() \u3092\u3057\u306a\u304b\u3063\u305f\u3068\u3059\u308b\n\n // \u3053\u3053\u3067 promise \u306e\u30c7\u30b9\u30c8\u30e9\u30af\u30bf\u304c\u4f8b\u5916\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u66f8\u304d\u8fbc\u3080\n}\n\nint main()\n{\n std::promise&lt;int&gt; p;\n std::future&lt;int&gt; f = p.get_future();\n\n std::thread t(calc, std::move(p));\n\n try {\n std::cout &lt;&lt; f.get() &lt;&lt; std::endl; // \u4e0a\u3067\u66f8\u304d\u8fbc\u307e\u308c\u305f\u4f8b\u5916\u304c\u9001\u51fa\u3055\u308c\u308b\n }\n catch (std::future_error&amp; e) {\n std::cout &lt;&lt; e.what() &lt;&lt; std::endl;\n }\n\n t.join();\n}\n&#34;}], &#34;page_id&#34;: [&#34;reference&#34;, &#34;future&#34;, &#34;promise&#34;, &#34;op_destructor&#34;]}">
7272
<nav class="navbar navbar-default" role="navigation">
7373
<div class="container-fluid">
7474
<div class="navbar-header">
@@ -200,8 +200,8 @@
200200

201201
<p class="text-right"><small>
202202
最終更新日時(UTC):
203-
<span itemprop="datePublished" content="2024-04-30T14:24:33">
204-
2024年04月30日 14時24分33秒
203+
<span itemprop="datePublished" content="2024-04-30T15:29:19">
204+
2024年04月30日 15時29分19秒
205205
</span>
206206
<br/>
207207
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
@@ -236,11 +236,39 @@ <h2>効果</h2>
236236
<li>共有状態を解放する。</li>
237237
</ol>
238238
<h2></h2>
239-
<p><div class="codehilite"><pre><span></span><code>
239+
<p><div class="yata" id="33d4c7391b53beb4e3943168653ec0b931251583"><div class="codehilite"><pre><span></span><code><span class="cp">#include</span> <span class="cpf"><a href="https://cpprefjp.github.io/reference/iostream.html">&lt;iostream&gt;</a></span><span class="cp"></span>
240+
<span class="cp">#include</span> <span class="cpf"><a href="https://cpprefjp.github.io/reference/future.html">&lt;future&gt;</a></span><span class="cp"></span>
241+
<span class="cp">#include</span> <span class="cpf"><a href="https://cpprefjp.github.io/reference/thread.html">&lt;thread&gt;</a></span><span class="cp"></span>
242+
<span class="cp">#include</span> <span class="cpf"><a href="https://cpprefjp.github.io/reference/utility.html">&lt;utility&gt;</a></span><span class="cp"></span>
243+
244+
<span class="kt">void</span> <span class="nf">calc</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">promise</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="n">p</span><span class="p">)</span>
245+
<span class="p">{</span>
246+
<span class="c1">// 通常行う p.set_value() をしなかったとする</span>
247+
248+
<span class="c1">// ここで promise のデストラクタが例外オブジェクトを書き込む</span>
249+
<span class="p">}</span>
250+
251+
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span>
252+
<span class="p">{</span>
253+
<span class="n">std</span><span class="o">::</span><span class="n">promise</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="n">p</span><span class="p">;</span>
254+
<span class="n"><a href="https://cpprefjp.github.io/reference/future/future.html">std::future</a></span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="n">f</span> <span class="o">=</span> <span class="n"><a href="https://cpprefjp.github.io/reference/future/promise/get_future.html">p.get_future()</a></span><span class="p">;</span>
255+
256+
<span class="n"><a href="https://cpprefjp.github.io/reference/thread/thread.html">std::thread</a></span> <span class="n">t</span><span class="p">(</span><span class="n">calc</span><span class="p">,</span> <span class="n"><a href="https://cpprefjp.github.io/reference/utility/move.html">std::move</a></span><span class="p">(</span><span class="n">p</span><span class="p">));</span>
257+
258+
<span class="k">try</span> <span class="p">{</span>
259+
<span class="n"><a href="https://cpprefjp.github.io/reference/iostream/cout.html">std::cout</a></span> <span class="o">&lt;&lt;</span> <span class="n"><a href="https://cpprefjp.github.io/reference/future/future/get.html">f.get()</a></span> <span class="o">&lt;&lt;</span> <span class="n"><a href="https://cpprefjp.github.io/reference/ostream/endl.html">std::endl</a></span><span class="p">;</span> <span class="c1">// 上で書き込まれた例外が送出される</span>
260+
<span class="p">}</span>
261+
<span class="k">catch</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">future_error</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
262+
<span class="n"><a href="https://cpprefjp.github.io/reference/iostream/cout.html">std::cout</a></span> <span class="o">&lt;&lt;</span> <span class="n">e</span><span class="p">.</span><span class="n">what</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n"><a href="https://cpprefjp.github.io/reference/ostream/endl.html">std::endl</a></span><span class="p">;</span>
263+
<span class="p">}</span>
264+
265+
<span class="n"><a href="https://cpprefjp.github.io/reference/thread/thread/join.html">t.join()</a></span><span class="p">;</span>
266+
<span class="p">}</span>
240267
</code></pre></div>
241-
</p>
242-
<h3>出力</h3>
243-
<p><pre><code></code></pre></p>
268+
</div></p>
269+
<h3>出力例</h3>
270+
<p><pre><code>std::future_error: Broken promise
271+
</code></pre></p>
244272
<h2>バージョン</h2>
245273
<h3>言語</h3>
246274
<ul>

rss.xml

Lines changed: 67 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,75 @@
22
<feed xmlns="http://www.w3.org/2005/Atom">
33
<title>cpprefjp - C++日本語リファレンス</title>
44
<link href="https://cpprefjp.github.io" />
5-
<updated>2024-04-30T14:38:51.283716</updated>
6-
<id>b769832f-9b6b-494e-99d3-a530066f63af</id>
5+
<updated>2024-04-30T15:33:30.991579</updated>
6+
<id>1c85f645-130c-49f6-aec5-6267f3741f42</id>
77

88

9+
<entry>
10+
<title>デストラクタ -- promiseデストラクタが例外を格納するコード例を作成 #1270</title>
11+
<link href="https://cpprefjp.github.io/reference/future/promise/op_destructor.html"/>
12+
<id>8e854b8d24bb6774f4e3622c881edc0addde5614:reference/future/promise/op_destructor.md</id>
13+
<updated>2024-05-01T00:29:19+09:00</updated>
14+
15+
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/future/promise/op_destructor.md b/reference/future/promise/op_destructor.md
16+
index 6203910d3..a922bd7d3 100644
17+
--- a/reference/future/promise/op_destructor.md
18+
+++ b/reference/future/promise/op_destructor.md
19+
@@ -18,11 +18,44 @@
20+
2. 共有状態を解放する。
21+
22+
## 例
23+
-```cpp
24+
+```cpp example
25+
+#include &amp;lt;iostream&amp;gt;
26+
+#include &amp;lt;future&amp;gt;
27+
+#include &amp;lt;thread&amp;gt;
28+
+#include &amp;lt;utility&amp;gt;
29+
+
30+
+void calc(std::promise&amp;lt;int&amp;gt; p)
31+
+{
32+
+ // 通常行う p.set_value() をしなかったとする
33+
+
34+
+ // ここで promise のデストラクタが例外オブジェクトを書き込む
35+
+}
36+
+
37+
+int main()
38+
+{
39+
+ std::promise&amp;lt;int&amp;gt; p;
40+
+ std::future&amp;lt;int&amp;gt; f = p.get_future();
41+
+
42+
+ std::thread t(calc, std::move(p));
43+
+
44+
+ try {
45+
+ std::cout &amp;lt;&amp;lt; f.get() &amp;lt;&amp;lt; std::endl; // 上で書き込まれた例外が送出される
46+
+ }
47+
+ catch (std::future_error&amp;amp; e) {
48+
+ std::cout &amp;lt;&amp;lt; e.what() &amp;lt;&amp;lt; std::endl;
49+
+ }
50+
+
51+
+ t.join();
52+
+}
53+
```
54+
+* std::future[link /reference/future/future.md]
55+
+* p.get_future()[link get_future.md]
56+
+* std::move[link /reference/utility/move.md]
57+
+* f.get()[link /reference/future/future/get.md]
58+
59+
-### 出力
60+
+### 出力例
61+
```
62+
+std::future_error: Broken promise
63+
```
64+
65+
## バージョン
66+
&lt;/code&gt;&lt;/pre&gt;</summary>
67+
68+
<author>
69+
<name>tshino</name>
70+
<email>[email protected]</email>
71+
</author>
72+
</entry>
73+
974
<entry>
1075
<title>デストラクタ -- 共有状態を放棄するとき例外を格納する動作を追記(規格に明記された3メソッド) #1270</title>
1176
<link href="https://cpprefjp.github.io/reference/future/packaged_task/op_destructor.html"/>
@@ -180,34 +245,4 @@ index 50f3d223f..de63ef902 100644
180245
</author>
181246
</entry>
182247

183-
<entry>
184-
<title>async -- `std::async` throw `std::system_error`</title>
185-
<link href="https://cpprefjp.github.io/reference/future/async.html"/>
186-
<id>0a7bbedcfb3cbe0c6fc59102d25a3e71a2447461:reference/future/async.md</id>
187-
<updated>2024-04-27T16:04:39+09:00</updated>
188-
189-
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/future/async.md b/reference/future/async.md
190-
index 50f3d223f..de63ef902 100644
191-
--- a/reference/future/async.md
192-
+++ b/reference/future/async.md
193-
@@ -85,9 +85,9 @@ namespace std {
194-
非同期実行される関数オブジェクト`f`の結果値取得のための`future`オブジェクトを返す。
195-
196-
## 例外
197-
-この関数は、以下のerror conditionを持つ[`future_error`](future_error.md)例外オブジェクトを送出する可能性がある:
198-
+この関数は、以下のerror conditionを持つ[`system_error`](/reference/system_error/system_error.md)例外オブジェクトを送出する可能性がある:
199-
200-
-- [`resource_unavailable_try_again`](future_errc.md) : [`launch::async`](launch.md)が指定され、新たなスレッドを起動しようとしたができなかった
201-
+- [`resource_unavailable_try_again`](/reference/system_error/errc.md) : [`launch::async`](launch.md)が指定され、新たなスレッドを起動しようとしたができなかった
202-
203-
## launch::asyncポリシーを指定した場合の注意点
204-
205-
&lt;/code&gt;&lt;/pre&gt;</summary>
206-
207-
<author>
208-
<name>Nagarei</name>
209-
<email>[email protected]</email>
210-
</author>
211-
</entry>
212-
213248
</feed>

sitemap.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11273,7 +11273,7 @@
1127311273

1127411274
<url>
1127511275
<loc>https://cpprefjp.github.io/reference/future/promise/op_destructor.html</loc>
11276-
<lastmod>2024-04-30T23:24:33+09:00</lastmod>
11276+
<lastmod>2024-05-01T00:29:19+09:00</lastmod>
1127711277
<changefreq>daily</changefreq>
1127811278
<priority>0.6</priority>
1127911279
</url>

0 commit comments

Comments
 (0)