|
68 | 68 |
|
69 | 69 | </head> |
70 | 70 | <body> |
71 | | -<header data-kunai-mdinfo="{"meta": {"header": ["any"], "namespace": ["std"], "class": ["any"], "id-type": ["function"], "cpp": ["cpp17"]}, "sources": [{"id": "3134ab6a4262c0b5cd1cbb1d7bd14127655bc475", "source": "#include <any>\n#include <string>\n#include <vector>\n#include <cassert>\n\nint main()\n{\n // (1)\n {\n std::any x;\n assert(!x.has_value());\n }\n\n // (2)\n {\n std::any a = 3;\n std::any b = a;\n\n assert(std::any_cast<int>(a) == 3);\n assert(std::any_cast<int>(b) == 3);\n }\n\n // (3)\n {\n std::any a = std::string(\"Hello\");\n std::any b = std::move(a);\n\n assert(std::any_cast<std::string>(b) == \"Hello\");\n }\n\n // (4)\n {\n std::any a = 3;\n std::any b = std::string(\"Hello\");\n\n assert(std::any_cast<int>(a) == 3);\n assert(std::any_cast<std::string>(b) == \"Hello\");\n }\n\n // (5)\n {\n std::any x {\n std::in_place_type<std::string>,\n 3,\n 'z'\n };\n\n assert(std::any_cast<std::string>(x) == \"zzz\");\n }\n\n // (6)\n {\n std::allocator<int> alloc;\n std::any x {\n std::in_place_type<std::vector<int>>,\n {3, 1, 4},\n alloc\n };\n\n const auto& vec = std::any_cast<const std::vector<int>&>(x);\n assert(vec[0] == 3);\n assert(vec[1] == 1);\n assert(vec[2] == 4);\n }\n}\n"}], "page_id": ["reference", "any", "any", "op_constructor"]}"> |
| 71 | +<header data-kunai-mdinfo="{"meta": {"header": ["any"], "namespace": ["std"], "class": ["any"], "id-type": ["function"], "cpp": ["cpp17"]}, "sources": [{"id": "658833a7434fdb0dbc3c2921c79645ac9bc76065", "source": "#include <any>\n#include <string>\n#include <vector>\n#include <cassert>\n#include <utility>\n\nint main()\n{\n // (1)\n {\n std::any x;\n assert(!x.has_value());\n }\n\n // (2)\n {\n std::any a = 3;\n std::any b = a;\n\n assert(std::any_cast<int>(a) == 3);\n assert(std::any_cast<int>(b) == 3);\n }\n\n // (3)\n {\n std::any a = std::string(\"Hello\");\n std::any b = std::move(a);\n\n assert(std::any_cast<std::string>(b) == \"Hello\");\n }\n\n // (4)\n {\n std::any a = 3;\n std::any b = std::string(\"Hello\");\n\n assert(std::any_cast<int>(a) == 3);\n assert(std::any_cast<std::string>(b) == \"Hello\");\n }\n\n // (5)\n {\n std::any x {\n std::in_place_type<std::string>,\n 3,\n 'z'\n };\n\n assert(std::any_cast<std::string>(x) == \"zzz\");\n }\n\n // (6)\n {\n std::allocator<int> alloc;\n std::any x {\n std::in_place_type<std::vector<int>>,\n {3, 1, 4},\n alloc\n };\n\n const auto& vec = std::any_cast<const std::vector<int>&>(x);\n assert(vec[0] == 3);\n assert(vec[1] == 1);\n assert(vec[2] == 4);\n }\n}\n"}], "page_id": ["reference", "any", "any", "op_constructor"]}"> |
72 | 72 | <nav class="navbar navbar-default" role="navigation"> |
73 | 73 | <div class="container-fluid"> |
74 | 74 | <div class="navbar-header"> |
|
201 | 201 | <p class="text-right"><small> |
202 | 202 | 最終更新日時: |
203 | 203 | <time itemprop="datePublished" class="js-local-time" |
204 | | - datetime="2024-06-11T22:45:38+09:00"> |
205 | | - 2024年06月11日 22時45分38秒 (JST) |
| 204 | + datetime="2026-07-22T11:09:53+09:00"> |
| 205 | + 2026年07月22日 11時09分53秒 (JST) |
206 | 206 | </time> |
207 | 207 | <br/> |
208 | 208 | <span itemprop="author" itemscope itemtype="http://schema.org/Person"> |
209 | | - <span itemprop="name">Akira Takahashi</span> |
| 209 | + <span itemprop="name">rotarymars</span> |
210 | 210 | </span> |
211 | 211 | が更新 |
212 | 212 | </small></p> |
@@ -300,10 +300,11 @@ <h2><a class="cpprefjp-defined-word" data-desc="問題が発生したときに |
300 | 300 | <li>(4), (5), (6) : 型<code><a href="../../type_traits/decay.html">std::decay_t<T></a></code>の選択されたコンストラクタが、任意の<a class="cpprefjp-defined-word" data-desc="問題が発生したときに、現在実行位置を過去に通過・記録した位置に戻し、文脈情報を添えて紐づけられた処理(例外ハンドラー)を呼び出す仕組み。またはその事態">例外</a>を送出する可能性がある</li> |
301 | 301 | </ul> |
302 | 302 | <h2>例</h2> |
303 | | -<p><div class="yata" id="3134ab6a4262c0b5cd1cbb1d7bd14127655bc475"><div class="codehilite"><pre><span></span><code><span class="cp">#include <a href="../../any.html"><any></a></span> |
| 303 | +<p><div class="yata" id="658833a7434fdb0dbc3c2921c79645ac9bc76065"><div class="codehilite"><pre><span></span><code><span class="cp">#include <a href="../../any.html"><any></a></span> |
304 | 304 | <span class="cp">#include <a href="../../string.html"><string></a></span> |
305 | 305 | <span class="cp">#include <a href="../../vector.html"><vector></a></span> |
306 | 306 | <span class="cp">#include <a href="../../cassert.html"><cassert></a></span> |
| 307 | +<span class="cp">#include <a href="../../utility.html"><utility></a></span> |
307 | 308 |
|
308 | 309 | <span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span> |
309 | 310 | <span class="p">{</span> |
|
0 commit comments