|
20 | 20 |
|
21 | 21 | <meta name="viewport" content="width=device-width,initial-scale=1"> |
22 | 22 | <meta name="keywords" content=" |
23 | | - C++,標準ライブラリ,リファレンス,ドキュメント,STL,std,utility,std,class template,cpp26 |
| 23 | + C++,標準ライブラリ,リファレンス,ドキュメント,STL,std,utility,std,class template,cpp26,cw |
24 | 24 | "> |
25 | 25 | <meta name="title" content="std::constant_wrapper - cpprefjp C++日本語リファレンス" /> |
26 | 26 | <meta itemprop="name" content="std::constant_wrapper - cpprefjp C++日本語リファレンス" /> |
|
68 | 68 |
|
69 | 69 | </head> |
70 | 70 | <body> |
71 | | -<header data-kunai-mdinfo="{"meta": {"header": ["utility"], "namespace": ["std"], "id-type": ["class template"], "cpp": ["cpp26"]}, "sources": [{"id": "a446cb3dc1ef6ab7ee1c0d647414be67501a4b30", "source": "#include <utility>\n#include <iostream>\n\n// \u5b9a\u6570\u3092\u901a\u5e38\u306e\u95a2\u6570\u5f15\u6570\u3068\u3057\u3066\u53d7\u3051\u53d6\u308a\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u8a08\u7b97\u3059\u308b\u9ad8\u968e\u95a2\u6570\nconstexpr auto add(auto a, auto b)\n{\n return a + b;\n}\n\nint main()\n{\n // cw<42>\u3068cw<13>\u306f\u3001\u5024\u3092\u578b\u3068\u3057\u3066\u4fdd\u6301\u3059\u308b\n auto result = add(std::cw<42>, std::cw<13>);\n\n // result\u306fconstant_wrapper<55>\u578b\u3067\u3042\u308a\u3001\n // result\u81ea\u8eab\u304c\u5b9a\u6570\u5f0f\u3067\u306a\u304f\u3066\u3082\u3001\u305d\u306e\u5024\u306f\u5b9a\u6570\u5f0f\u3068\u3057\u3066\u4f7f\u7528\u3067\u304d\u308b\n static_assert(result == 55);\n\n std::cout << result << std::endl;\n}\n"}, {"id": "27422a2a2aea631b4d0836c2e1bd7f96b3106ec2", "source": "#include <utility>\n#include <type_traits>\n\nint main()\n{\n // \u30aa\u30da\u30e9\u30f3\u30c9\u304c\u3059\u3079\u3066constant_wrapper\u306a\u3089\u3001\u6f14\u7b97\u7d50\u679c\u3082\u518d\u3073constant_wrapper\u306b\u306a\u308b\n auto a = std::cw<10> + std::cw<5>;\n static_assert(std::is_same_v<decltype(a), std::constant_wrapper<15>>);\n\n // \u30aa\u30da\u30e9\u30f3\u30c9\u306e\u3044\u305a\u308c\u304b\u304c\u901a\u5e38\u306e\u5024\u306a\u3089\u3001\u4fdd\u6301\u3059\u308b\u5024\u3078\u30a2\u30f3\u30e9\u30c3\u30d7\u3057\u3066\u6f14\u7b97\u3059\u308b\n auto b = std::cw<10> + 5;\n static_assert(std::is_same_v<decltype(b), int>);\n}\n"}, {"id": "5bf83602089629874fd70340d8eca7ae0a9b0891", "source": "#include <utility>\n#include <iostream>\n\nconstexpr int triple(int x) { return x * 3; }\n\n// constant_wrapper\u306fNTTP\u3068\u3057\u3066\u4f7f\u3046\u305f\u3081\u306b\u540d\u524d\u7a7a\u9593\u30b9\u30b3\u30fc\u30d7\u306b\u7f6e\u304f\nconstexpr int data[] = {0, 10, 20, 30};\n\nint main()\n{\n // cw<triple>\u3092\u95a2\u6570\u547c\u3073\u51fa\u3057\u3059\u308b\u3068\u3001\u4fdd\u6301\u3059\u308b\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\n // \u5f15\u6570\u3082constant_wrapper\u306a\u3089\u3001\u7d50\u679c\u3092\u518d\u3073constant_wrapper\u3067\u5305\u3080\n auto r = std::cw<triple>(std::cw<7>);\n static_assert(r == 21);\n std::cout << r << std::endl;\n\n // \u914d\u5217\u3092\u4fdd\u6301\u3057\u3066\u6dfb\u5b57\u30a2\u30af\u30bb\u30b9\u3059\u308b\n auto e = std::cw<data>[std::cw<2>];\n static_assert(e == 20);\n std::cout << e << std::endl;\n}\n"}], "page_id": ["reference", "utility", "constant_wrapper"]}"> |
| 71 | +<header data-kunai-mdinfo="{"meta": {"header": ["utility"], "namespace": ["std"], "id-type": ["class template"], "cpp": ["cpp26"], "alias": ["cw"]}, "sources": [{"id": "a446cb3dc1ef6ab7ee1c0d647414be67501a4b30", "source": "#include <utility>\n#include <iostream>\n\n// \u5b9a\u6570\u3092\u901a\u5e38\u306e\u95a2\u6570\u5f15\u6570\u3068\u3057\u3066\u53d7\u3051\u53d6\u308a\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u8a08\u7b97\u3059\u308b\u9ad8\u968e\u95a2\u6570\nconstexpr auto add(auto a, auto b)\n{\n return a + b;\n}\n\nint main()\n{\n // cw<42>\u3068cw<13>\u306f\u3001\u5024\u3092\u578b\u3068\u3057\u3066\u4fdd\u6301\u3059\u308b\n auto result = add(std::cw<42>, std::cw<13>);\n\n // result\u306fconstant_wrapper<55>\u578b\u3067\u3042\u308a\u3001\n // result\u81ea\u8eab\u304c\u5b9a\u6570\u5f0f\u3067\u306a\u304f\u3066\u3082\u3001\u305d\u306e\u5024\u306f\u5b9a\u6570\u5f0f\u3068\u3057\u3066\u4f7f\u7528\u3067\u304d\u308b\n static_assert(result == 55);\n\n std::cout << result << std::endl;\n}\n"}, {"id": "27422a2a2aea631b4d0836c2e1bd7f96b3106ec2", "source": "#include <utility>\n#include <type_traits>\n\nint main()\n{\n // \u30aa\u30da\u30e9\u30f3\u30c9\u304c\u3059\u3079\u3066constant_wrapper\u306a\u3089\u3001\u6f14\u7b97\u7d50\u679c\u3082\u518d\u3073constant_wrapper\u306b\u306a\u308b\n auto a = std::cw<10> + std::cw<5>;\n static_assert(std::is_same_v<decltype(a), std::constant_wrapper<15>>);\n\n // \u30aa\u30da\u30e9\u30f3\u30c9\u306e\u3044\u305a\u308c\u304b\u304c\u901a\u5e38\u306e\u5024\u306a\u3089\u3001\u4fdd\u6301\u3059\u308b\u5024\u3078\u30a2\u30f3\u30e9\u30c3\u30d7\u3057\u3066\u6f14\u7b97\u3059\u308b\n auto b = std::cw<10> + 5;\n static_assert(std::is_same_v<decltype(b), int>);\n}\n"}, {"id": "5bf83602089629874fd70340d8eca7ae0a9b0891", "source": "#include <utility>\n#include <iostream>\n\nconstexpr int triple(int x) { return x * 3; }\n\n// constant_wrapper\u306fNTTP\u3068\u3057\u3066\u4f7f\u3046\u305f\u3081\u306b\u540d\u524d\u7a7a\u9593\u30b9\u30b3\u30fc\u30d7\u306b\u7f6e\u304f\nconstexpr int data[] = {0, 10, 20, 30};\n\nint main()\n{\n // cw<triple>\u3092\u95a2\u6570\u547c\u3073\u51fa\u3057\u3059\u308b\u3068\u3001\u4fdd\u6301\u3059\u308b\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\n // \u5f15\u6570\u3082constant_wrapper\u306a\u3089\u3001\u7d50\u679c\u3092\u518d\u3073constant_wrapper\u3067\u5305\u3080\n auto r = std::cw<triple>(std::cw<7>);\n static_assert(r == 21);\n std::cout << r << std::endl;\n\n // \u914d\u5217\u3092\u4fdd\u6301\u3057\u3066\u6dfb\u5b57\u30a2\u30af\u30bb\u30b9\u3059\u308b\n auto e = std::cw<data>[std::cw<2>];\n static_assert(e == 20);\n std::cout << e << std::endl;\n}\n"}], "page_id": ["reference", "utility", "constant_wrapper"]}"> |
72 | 72 | <nav class="navbar navbar-default" role="navigation"> |
73 | 73 | <div class="container-fluid"> |
74 | 74 | <div class="navbar-header"> |
|
188 | 188 |
|
189 | 189 | <p class="text-right"><small> |
190 | 190 | 最終更新日時(UTC): |
191 | | - <span itemprop="datePublished" content="2026-06-21T04:45:53"> |
192 | | - 2026年06月21日 04時45分53秒 |
| 191 | + <span itemprop="datePublished" content="2026-06-21T14:39:30"> |
| 192 | + 2026年06月21日 14時39分30秒 |
193 | 193 | </span> |
194 | 194 | <br/> |
195 | 195 | <span itemprop="author" itemscope itemtype="http://schema.org/Person"> |
196 | | - <span itemprop="name">Akira Takahashi</span> |
| 196 | + <span itemprop="name">yoh</span> |
197 | 197 | </span> |
198 | 198 | が更新 |
199 | 199 | </small></p> |
|
0 commit comments