Skip to content

Commit 3441aca

Browse files
author
cpprefjp-autoupdate
committed
update automatically
1 parent 89492e9 commit 3441aca

File tree

6 files changed

+200
-55
lines changed

6 files changed

+200
-55
lines changed

reference/future/future/get.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@
200200

201201
<p class="text-right"><small>
202202
最終更新日時(UTC):
203-
<span itemprop="datePublished" content="2024-06-11T13:45:38">
204-
2024年06月11日 13時45分38秒
203+
<span itemprop="datePublished" content="2025-01-04T04:22:52">
204+
2025年01月04日 04時22分52秒
205205
</span>
206206
<br/>
207207
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
208-
<span itemprop="name">Akira Takahashi</span>
208+
<span itemprop="name">I</span>
209209
</span>
210210
が更新
211211
</small></p>
@@ -242,6 +242,13 @@ <h2><a class="cpprefjp-defined-word" data-desc="関数呼び出し式の評価
242242
</ul>
243243
<h2><a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a></h2>
244244
<p>共有状態に<a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>が格納されていた場合、格納されている<a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を送出する。</p>
245+
<h2><a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Preconditions。関数呼び出し時に満たされていると関数が想定する条件。満たさなければ未定義の動作。契約属性の`[[expects]]`に相当">事前条件</a></h2>
246+
<ul>
247+
<li><code><a href="valid.html">valid()</a> == true</code><ul>
248+
<li>この条件を満たさなかった場合、処理系によっては<code><a href="../future_error.html">future_error</a></code><a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を投げることがある。</li>
249+
</ul>
250+
</li>
251+
</ul>
245252
<h2><a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Postconditions。関数を実行後に満たされている条件。契約属性の`[[ensures]]`に相当">事後条件</a></h2>
246253
<p>この関数呼び出し後は共有状態が破棄され、<code><a href="valid.html">valid()</a> == false</code>となること。</p>
247254
<p>つまりこの関数は1オブジェクトにつき1回しか呼び出せない。</p>

reference/future/future/wait.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@
200200

201201
<p class="text-right"><small>
202202
最終更新日時(UTC):
203-
<span itemprop="datePublished" content="2024-06-11T13:45:38">
204-
2024年06月11日 13時45分38秒
203+
<span itemprop="datePublished" content="2025-01-04T04:22:52">
204+
2025年01月04日 04時22分52秒
205205
</span>
206206
<br/>
207207
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
208-
<span itemprop="name">Akira Takahashi</span>
208+
<span itemprop="name">I</span>
209209
</span>
210210
が更新
211211
</small></p>
@@ -234,6 +234,13 @@ <h2>効果</h2>
234234
<p>共有状態が準備完了状態(<code><a href="../future_status.html">future_status::ready</a></code>)になるまでこの関数をブロックする。</p>
235235
<h2><a class="cpprefjp-defined-word" data-desc="関数呼び出し式の評価結果となるオブジェクト・値">戻り値</a></h2>
236236
<p>なし</p>
237+
<h2><a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Preconditions。関数呼び出し時に満たされていると関数が想定する条件。満たさなければ未定義の動作。契約属性の`[[expects]]`に相当">事前条件</a></h2>
238+
<ul>
239+
<li><code><a href="valid.html">valid()</a> == true</code><ul>
240+
<li>この条件を満たさなかった場合、処理系によっては<code><a href="../future_error.html">future_error</a></code><a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を投げることがある。</li>
241+
</ul>
242+
</li>
243+
</ul>
237244
<h2></h2>
238245
<p><div class="yata" id="9d3245e4cf7b7e14d30d7c95c6a95889bb313d10"><div class="codehilite"><pre><span></span><code><span class="cp">#include</span> <span class="cpf"><a href="../../iostream.html">&lt;iostream&gt;</a></span><span class="cp"></span>
239246
<span class="cp">#include</span> <span class="cpf"><a href="../../future.html">&lt;future&gt;</a></span><span class="cp"></span>

reference/future/future/wait_for.html

Lines changed: 13 additions & 13 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;future&#34;], &#34;id-type&#34;: [&#34;function template&#34;], &#34;cpp&#34;: [&#34;cpp11&#34;]}, &#34;sources&#34;: [{&#34;id&#34;: &#34;ca76fe51671a15677ad5a83f5d34211cc477aa73&#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 p.set_value(3); // \u7d50\u679c\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 // \u7d50\u679c\u304c\u66f8\u304d\u8fbc\u307e\u308c\u308b\u307e\u3067\u5f85\u6a5f\u3059\u308b\n // 3\u79d2\u3067\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\n std::future_status result = f.wait_for(std::chrono::seconds(3));\n if (result != std::future_status::timeout) {\n // \u7d50\u679c\u3092\u53d6\u308a\u51fa\u3059(\u6e96\u5099\u5b8c\u4e86\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u3059\u3050\u306b\u5024\u3092\u53d6\u308a\u51fa\u305b\u308b)\n std::cout &lt;&lt; f.get() &lt;&lt; std::endl;\n }\n else {\n std::cout &lt;&lt; \&#34;timeout\&#34; &lt;&lt; std::endl;\n }\n\n t.join();\n}\n&#34;}, {&#34;id&#34;: &#34;477e26dab1ecdab718bfa27e364f00ef465132cf&#34;, &#34;source&#34;: &#34;#include &lt;iostream&gt;\n#include &lt;future&gt;\n#include &lt;chrono&gt;\n\nint main()\n{\n std::promise&lt;int&gt; p;\n std::future&lt;int&gt; f = p.get_future();\n const auto ready = [&amp;f] {\n return f.wait_for(std::chrono::seconds{0}) == std::future_status::ready;\n };\n\n // \u307e\u3060\u5024\u306f\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\n std::cout &lt;&lt; std::boolalpha &lt;&lt; ready() &lt;&lt; std::endl;\n\n p.set_value(1);\n\n // \u5024\u304c\u30bb\u30c3\u30c8\u3055\u308c\u305f\n std::cout &lt;&lt; std::boolalpha &lt;&lt; ready() &lt;&lt; std::endl;\n\n f.get(); // \u4e00\u5ea6\u5024\u3092\u53d6\u308a\u51fa\u3059\u3068\u5171\u6709\u72b6\u614b\u304c\u7834\u68c4\u3055\u308c\u308b\n\n // \u5171\u6709\u72b6\u614b\u3092\u6301\u305f\u306a\u3044(valid() == false\u306a)future\u3067wait\u3092\u3059\u308b\u3068std::future_error\u4f8b\u5916\n // \u305f\u3060\u3057\u3001libc++\u3067\u306f(\u5c11\u306a\u304f\u3068\u308219.1.0\u307e\u3067\u306f)SEGV\u3059\u308b\u306e\u3067\u6ce8\u610f\n try {\n ready();\n }\n catch(const std::future_error&amp; e) {\n std::cout &lt;&lt; e.what() &lt;&lt; std::endl;\n }\n}\n&#34;}], &#34;page_id&#34;: [&#34;reference&#34;, &#34;future&#34;, &#34;future&#34;, &#34;wait_for&#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;future&#34;], &#34;id-type&#34;: [&#34;function template&#34;], &#34;cpp&#34;: [&#34;cpp11&#34;]}, &#34;sources&#34;: [{&#34;id&#34;: &#34;ca76fe51671a15677ad5a83f5d34211cc477aa73&#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 p.set_value(3); // \u7d50\u679c\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 // \u7d50\u679c\u304c\u66f8\u304d\u8fbc\u307e\u308c\u308b\u307e\u3067\u5f85\u6a5f\u3059\u308b\n // 3\u79d2\u3067\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\n std::future_status result = f.wait_for(std::chrono::seconds(3));\n if (result != std::future_status::timeout) {\n // \u7d50\u679c\u3092\u53d6\u308a\u51fa\u3059(\u6e96\u5099\u5b8c\u4e86\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u3059\u3050\u306b\u5024\u3092\u53d6\u308a\u51fa\u305b\u308b)\n std::cout &lt;&lt; f.get() &lt;&lt; std::endl;\n }\n else {\n std::cout &lt;&lt; \&#34;timeout\&#34; &lt;&lt; std::endl;\n }\n\n t.join();\n}\n&#34;}, {&#34;id&#34;: &#34;67bfb990a6eaeee537e0c4e1a943037bd4e707ab&#34;, &#34;source&#34;: &#34;#include &lt;iostream&gt;\n#include &lt;future&gt;\n#include &lt;chrono&gt;\n\nint main()\n{\n std::promise&lt;int&gt; p;\n std::future&lt;int&gt; f = p.get_future();\n const auto ready = [&amp;f] {\n return f.wait_for(std::chrono::seconds{0}) == std::future_status::ready;\n };\n\n // \u307e\u3060\u5024\u306f\u30bb\u30c3\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\n std::cout &lt;&lt; std::boolalpha &lt;&lt; ready() &lt;&lt; std::endl;\n\n p.set_value(1);\n\n // \u5024\u304c\u30bb\u30c3\u30c8\u3055\u308c\u305f\n std::cout &lt;&lt; std::boolalpha &lt;&lt; ready() &lt;&lt; std::endl;\n\n f.get(); // \u4e00\u5ea6\u5024\u3092\u53d6\u308a\u51fa\u3059\u3068\u5171\u6709\u72b6\u614b\u304c\u7834\u68c4\u3055\u308c\u308b\n\n // \u5171\u6709\u72b6\u614b\u3092\u6301\u305f\u306a\u3044(valid() == false\u306a)future\u3067wait\u3092\u3059\u308b\u3068UB\n // ready();\n}\n&#34;}], &#34;page_id&#34;: [&#34;reference&#34;, &#34;future&#34;, &#34;future&#34;, &#34;wait_for&#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="2025-01-04T00:32:32">
204-
2025年01月04日 00時32分32秒
203+
<span itemprop="datePublished" content="2025-01-04T04:22:52">
204+
2025年01月04日 04時22分52秒
205205
</span>
206206
<br/>
207207
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
@@ -243,6 +243,13 @@ <h2><a class="cpprefjp-defined-word" data-desc="問題が発生したときに
243243
<ul>
244244
<li>C++14 : 時計クラス、<code><a href="../../chrono/time_point.html">time_point</a></code>クラス、<code><a href="../../chrono/duration.html">duration</a></code>クラスの構築が<a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を送出する場合、この関数はそれらの<a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を送出する。</li>
245245
</ul>
246+
<h2><a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Preconditions。関数呼び出し時に満たされていると関数が想定する条件。満たさなければ未定義の動作。契約属性の`[[expects]]`に相当">事前条件</a></h2>
247+
<ul>
248+
<li><code><a href="valid.html">valid()</a> == true</code><ul>
249+
<li>この条件を満たさなかった場合、処理系によっては<code><a href="../future_error.html">future_error</a></code><a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を投げることがある。</li>
250+
</ul>
251+
</li>
252+
</ul>
246253
<h2></h2>
247254
<h3>例1</h3>
248255
<p><div class="yata" id="ca76fe51671a15677ad5a83f5d34211cc477aa73"><div class="codehilite"><pre><span></span><code><span class="cp">#include</span> <span class="cpf"><a href="../../iostream.html">&lt;iostream&gt;</a></span><span class="cp"></span>
@@ -281,7 +288,7 @@ <h4>出力例</h4>
281288
<p><pre><code>3
282289
</code></pre></p>
283290
<h3>例2</h3>
284-
<p><div class="yata" id="477e26dab1ecdab718bfa27e364f00ef465132cf"><div class="codehilite"><pre><span></span><code><span class="cp">#include</span> <span class="cpf"><a href="../../iostream.html">&lt;iostream&gt;</a></span><span class="cp"></span>
291+
<p><div class="yata" id="67bfb990a6eaeee537e0c4e1a943037bd4e707ab"><div class="codehilite"><pre><span></span><code><span class="cp">#include</span> <span class="cpf"><a href="../../iostream.html">&lt;iostream&gt;</a></span><span class="cp"></span>
285292
<span class="cp">#include</span> <span class="cpf"><a href="../../future.html">&lt;future&gt;</a></span><span class="cp"></span>
286293
<span class="cp">#include</span> <span class="cpf"><a href="../../chrono.html">&lt;chrono&gt;</a></span><span class="cp"></span>
287294

@@ -303,21 +310,14 @@ <h3>例2</h3>
303310

304311
<span class="n"><a href="../shared_future/get.html">f.get()</a></span><span class="p">;</span> <span class="c1">// 一度値を取り出すと共有状態が破棄される</span>
305312

306-
<span class="c1">// 共有状態を持たない(<a href="valid.html">valid()</a> == falseな)futureでwaitをすると<a href="../future_error.html">std::future_error</a>例外</span>
307-
<span class="c1">// ただし、libc++では(少なくとも19.1.0までは)SEGVするので注意</span>
308-
<span class="k">try</span> <span class="p">{</span>
309-
<span class="n">ready</span><span class="p">();</span>
310-
<span class="p">}</span>
311-
<span class="k">catch</span><span class="p">(</span><span class="k">const</span> <span class="n"><a href="../future_error.html">std::future_error</a></span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
312-
<span class="n"><a href="../../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="../../ostream/endl.html">std::endl</a></span><span class="p">;</span>
313-
<span class="p">}</span>
313+
<span class="c1">// 共有状態を持たない(<a href="valid.html">valid()</a> == falseな)futureでwaitをするとUB</span>
314+
<span class="c1">// ready();</span>
314315
<span class="p">}</span>
315316
</code></pre></div>
316317
</div></p>
317318
<h4>出力例</h4>
318319
<p><pre><code>false
319320
true
320-
std::future_error: No associated state
321321
</code></pre></p>
322322
<h2>バージョン</h2>
323323
<h3>言語</h3>

reference/future/future/wait_until.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@
200200

201201
<p class="text-right"><small>
202202
最終更新日時(UTC):
203-
<span itemprop="datePublished" content="2024-06-11T13:45:38">
204-
2024年06月11日 13時45分38秒
203+
<span itemprop="datePublished" content="2025-01-04T04:22:52">
204+
2025年01月04日 04時22分52秒
205205
</span>
206206
<br/>
207207
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
208-
<span itemprop="name">Akira Takahashi</span>
208+
<span itemprop="name">I</span>
209209
</span>
210210
が更新
211211
</small></p>
@@ -247,6 +247,13 @@ <h2><a class="cpprefjp-defined-word" data-desc="問題が発生したときに
247247
<ul>
248248
<li>C++14 : 時計クラス、<code><a href="../../chrono/time_point.html">time_point</a></code>クラス、<code><a href="../../chrono/duration.html">duration</a></code>クラスの構築が<a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を送出する場合、この関数はそれらの<a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を送出する。</li>
249249
</ul>
250+
<h2><a class="cpprefjp-defined-word" data-desc="関数等の意味論を構成する要素の1つ。Preconditions。関数呼び出し時に満たされていると関数が想定する条件。満たさなければ未定義の動作。契約属性の`[[expects]]`に相当">事前条件</a></h2>
251+
<ul>
252+
<li><code><a href="valid.html">valid()</a> == true</code><ul>
253+
<li>この条件を満たさなかった場合、処理系によっては<code><a href="../future_error.html">future_error</a></code><a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を投げることがある。</li>
254+
</ul>
255+
</li>
256+
</ul>
250257
<h2></h2>
251258
<p><div class="yata" id="352fc1c6c9a0e24ccd380a0f1033f2d060b64b67"><div class="codehilite"><pre><span></span><code><span class="cp">#include</span> <span class="cpf"><a href="../../iostream.html">&lt;iostream&gt;</a></span><span class="cp"></span>
252259
<span class="cp">#include</span> <span class="cpf"><a href="../../future.html">&lt;future&gt;</a></span><span class="cp"></span>

0 commit comments

Comments
 (0)