|
2 | 2 | <feed xmlns="http://www.w3.org/2005/Atom"> |
3 | 3 | <title>cpprefjp - C++日本語リファレンス</title> |
4 | 4 | <link href="https://cpprefjp.github.io" /> |
5 | | - <updated>2025-06-14T08:42:07.746231</updated> |
6 | | - <id>41075c5b-a92e-43bb-8df8-c0264956ee0b</id> |
| 5 | + <updated>2025-06-14T09:22:48.749899</updated> |
| 6 | + <id>c9cae607-2d7f-4ced-aa41-b96dd9ca6122</id> |
7 | 7 |
|
8 | 8 |
|
| 9 | + <entry> |
| 10 | + <title>ssize -- checked gcc version for std::ssize()</title> |
| 11 | + <link href="https://cpprefjp.github.io/reference/iterator/ssize.html"/> |
| 12 | + <id>1434e2d7e07d1078914fdcea7c7a6bd7d40b33b1:reference/iterator/ssize.md</id> |
| 13 | + <updated>2025-06-14T18:18:52+09:00</updated> |
| 14 | + |
| 15 | + <summary type="html"><pre><code>diff --git a/reference/iterator/ssize.md b/reference/iterator/ssize.md |
| 16 | +index 263580943..24e2488d2 100644 |
| 17 | +--- a/reference/iterator/ssize.md |
| 18 | ++++ b/reference/iterator/ssize.md |
| 19 | +@@ -65,7 +65,7 @@ int main() |
| 20 | + |
| 21 | + ### 処理系 |
| 22 | + - [Clang](/implementation.md#clang): 9.0 [mark verified] |
| 23 | +-- [GCC](/implementation.md#gcc): |
| 24 | ++- [GCC](/implementation.md#gcc): 12.3.0 [mark verified] |
| 25 | + - [Visual C++](/implementation.md#visual_cpp): ?? |
| 26 | + |
| 27 | + |
| 28 | +</code></pre></summary> |
| 29 | + |
| 30 | + <author> |
| 31 | + <name>rotarymars</name> |
| 32 | + |
| 33 | + </author> |
| 34 | + </entry> |
| 35 | + |
9 | 36 | <entry> |
10 | 37 | <title>format -- improve chrono::format</title> |
11 | 38 | <link href="https://cpprefjp.github.io/reference/chrono/format.html"/> |
@@ -1109,287 +1136,6 @@ index 7c4b542b3..9e62e17ef 100644 |
1109 | 1136 | +- [P0408R7 Efficient Access to `basic_stringbuf`&#39;s Buffer](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0408r7.pdf) |
1110 | 1137 | +- [P2495R3 Interfacing stringstreams with `string_view`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2495r3.pdf) |
1111 | 1138 | + - C++26で[`std::string_view`](/reference/string_view/basic_string_view.md)に対応した |
1112 | | -</code></pre></summary> |
1113 | | - |
1114 | | - <author> |
1115 | | - <name>Akira Takahashi</name> |
1116 | | - |
1117 | | - </author> |
1118 | | - </entry> |
1119 | | - |
1120 | | - <entry> |
1121 | | - <title>コンストラクタ -- basic_stringbuf : C++26 string_viewに対応 #1186</title> |
1122 | | - <link href="https://cpprefjp.github.io/reference/sstream/basic_stringbuf/op_constructor.html"/> |
1123 | | - <id>9ff68ed23110ce265c33182f4f0e6cb074291660:reference/sstream/basic_stringbuf/op_constructor.md</id> |
1124 | | - <updated>2025-06-12T14:54:25+09:00</updated> |
1125 | | - |
1126 | | - <summary type="html"><pre><code>diff --git a/reference/sstream/basic_stringbuf/op_constructor.md b/reference/sstream/basic_stringbuf/op_constructor.md |
1127 | | -index ed4659c25..3e875f918 100644 |
1128 | | ---- a/reference/sstream/basic_stringbuf/op_constructor.md |
1129 | | -+++ b/reference/sstream/basic_stringbuf/op_constructor.md |
1130 | | -@@ -56,6 +56,23 @@ basic_stringbuf( |
1131 | | - |
1132 | | - basic_stringbuf(basic_stringbuf&amp;&amp; rhs); // (11) C++11 |
1133 | | - basic_stringbuf(basic_stringbuf&amp;&amp; rhs, const Allocator&amp; a); // (12) C++20 |
1134 | | -+ |
1135 | | -+template&lt;class T&gt; |
1136 | | -+explicit |
1137 | | -+basic_stringbuf( |
1138 | | -+ const T&amp; t, |
1139 | | -+ ios_base::openmode which = ios_base::in | ios_base::out); // (13) C++26 |
1140 | | -+ |
1141 | | -+template&lt;class T&gt; |
1142 | | -+basic_stringbuf( |
1143 | | -+ const T&amp; t, |
1144 | | -+ const Allocator&amp; a); // (14) C++26 |
1145 | | -+ |
1146 | | -+template&lt;class T&gt; |
1147 | | -+basic_stringbuf( |
1148 | | -+ const T&amp; t, |
1149 | | -+ ios_base::openmode which, |
1150 | | -+ const Allocator&amp; a); // (15) C++26 |
1151 | | - ``` |
1152 | | - * ios_base[link /reference/ios/ios_base.md] |
1153 | | - * basic_string[link /reference/string/basic_string.md] |
1154 | | -@@ -63,18 +80,43 @@ basic_stringbuf(basic_stringbuf&amp;&amp; rhs, const Allocator&amp; a); // (12) C++20 |
1155 | | - ## 概要 |
1156 | | - `basic_stringbuf`オブジェクトを構築する。 |
1157 | | - |
1158 | | -+- (1) : デフォルトコンストラクタ |
1159 | | -+- (2) : 指定されたモードで構築する |
1160 | | -+- (3) : [`std::basic_string`](/reference/string/basic_string.md)オブジェクトのコピーと、指定されたモードで構築する |
1161 | | -+- (4) : モードとアロケータを指定して構築する |
1162 | | -+- (5) : アロケータを指定して構築する |
1163 | | -+- (6) : [`std::basic_string`](/reference/string/basic_string.md)オブジェクトのコピーと、アロケータを指定して構築する |
1164 | | -+- (7) : [`std::basic_string`](/reference/string/basic_string.md)オブジェクトのコピー、モード、アロケータを指定して構築する |
1165 | | -+- (8) : `Allocator`に変換可能なアロケータ型をもつ`std::basic_string`オブジェクトのコピーと、指定されたモードで構築する |
1166 | | -+- (9) : `Allocator`に変換可能なアロケータ型をもつ`std::basic_string`オブジェクトのコピーと、アロケータを指定して構築する |
1167 | | -+- (10) : `Allocator`に変換可能なアロケータ型をもつ`std::basic_string`オブジェクトのコピー、モード、アロケータを指定して構築する |
1168 | | -+- (11) : ムーブコンストラクタ |
1169 | | -+- (12) : ムーブコンストラクタでアロケータを指定して構築する |
1170 | | -+- (13) : [`basic_string_view`](/reference/string_view/basic_string_view.md)に変換可能な文字列を初期化し、モードを設定する |
1171 | | -+- (14) : [`basic_string_view`](/reference/string_view/basic_string_view.md)に変換可能な文字列を初期化、アロケータを設定する |
1172 | | -+- (15) : [`basic_string_view`](/reference/string_view/basic_string_view.md)に変換可能な文字列を初期化し、モードとアロケータを設定する |
1173 | | -+ |
1174 | | -+ |
1175 | | -+## テンプレートパラメータ制約 |
1176 | | -+- (13), (14), (15) : `is_convertible_v&lt;const T&amp;, basic_string_view&lt;CharT, Traits&gt;&gt;`が`true`であること |
1177 | | -+ |
1178 | | -+ |
1179 | | - ## 効果 |
1180 | | - - (1) : 内部の文字列バッファを空にし、モードは`ios_base::in | ios_base::out`に設定する |
1181 | | - - (2) : 内部の文字列バッファを空にし、モードは`which`に設定する |
1182 | | - - (3) : 内部の文字列バッファを`s`のコピー、モードは`which`に設定する |
1183 | | - - (4) : 内部の文字列バッファを`std::move(s)`で、モードは`which`に設定する |
1184 | | - - (5) : 内部の文字列バッファを空にし、モードは`which`、アロケータは`a`に設定する |
1185 | | --- (6), (7), (8), (9), (10), (11) : 各引数は内部状態の初期化に使用される |
1186 | | --- (12) : `rhs`から`basic_stringbuf`オブジェクトをムーブ構築する |
1187 | | --- (13) : `rhs`から`basic_stringbuf`オブジェクトをムーブ構築し、アロケータは`a`を使用する |
1188 | | -+- (6), (7), (8), (9), (10) : 各引数は内部状態の初期化に使用される |
1189 | | -+- (11) : `rhs`から`basic_stringbuf`オブジェクトをムーブ構築する |
1190 | | -+- (12) : `rhs`から`basic_stringbuf`オブジェクトをムーブ構築し、アロケータは`a`を使用する |
1191 | | -+- (13) : `basic_string_view&lt;CharT, Traits&gt;(t)`で文字列を初期化し、モードは`which`に設定する |
1192 | | -+- (14) : `basic_string_view&lt;CharT, Traits&gt;(t)`で文字列を初期化し、モードは`ios_base::in | ios_base::out`、アロケータは`a`に設定する |
1193 | | -+- (15) : `basic_string_view&lt;CharT, Traits&gt;(t)`で文字列を初期化し、モードは`which`、アロケータは`a`に設定する |
1194 | | - |
1195 | | - |
1196 | | - ## 例 |
1197 | | -+### 基本的な使い方 |
1198 | | - ```cpp example |
1199 | | - #include &lt;iostream&gt; |
1200 | | - #include &lt;sstream&gt; |
1201 | | -@@ -95,11 +137,37 @@ int main() |
1202 | | - * sputc[link /reference/streambuf/basic_streambuf/sputc.md] |
1203 | | - * str()[link str.md] |
1204 | | - |
1205 | | --### 出力 |
1206 | | -+#### 出力 |
1207 | | - ``` |
1208 | | - a |
1209 | | - initial! |
1210 | | - ``` |
1211 | | - |
1212 | | -+#### string_viewからの構築 (C++26) |
1213 | | -+```cpp example |
1214 | | -+#include &lt;print&gt; |
1215 | | -+#include &lt;sstream&gt; |
1216 | | -+#include &lt;string_view&gt; |
1217 | | -+ |
1218 | | -+int main() |
1219 | | -+{ |
1220 | | -+ std::string_view sv = &#34;from string literal&#34;; |
1221 | | -+ std::stringbuf buf1{sv}; |
1222 | | -+ std::println(&#34;{}&#34;, buf1.str()); |
1223 | | -+ |
1224 | | -+ std::string_view sv2 = &#34;from string_view&#34;; |
1225 | | -+ std::stringbuf buf2{sv2}; |
1226 | | -+ std::println(&#34;{}&#34;, buf2.str()); |
1227 | | -+} |
1228 | | -+``` |
1229 | | -+ |
1230 | | -+#### 出力 |
1231 | | -+``` |
1232 | | -+from string literal |
1233 | | -+from string_view |
1234 | | -+``` |
1235 | | -+ |
1236 | | - ## 参照 |
1237 | | --- [P0408R7 Efficient Access to `basic_stringbuf`&#39;s Buffer](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0408r7.pdf) |
1238 | | -\ No newline at end of file |
1239 | | -+- [P0408R7 Efficient Access to `basic_stringbuf`&#39;s Buffer](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0408r7.pdf) |
1240 | | -+- [P2495R3 Interfacing stringstreams with `string_view`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2495r3.pdf) |
1241 | | -+ - C++26で[`std::string_view`](/reference/string_view/basic_string_view.md)に対応した |
1242 | | -</code></pre></summary> |
1243 | | - |
1244 | | - <author> |
1245 | | - <name>Akira Takahashi</name> |
1246 | | - |
1247 | | - </author> |
1248 | | - </entry> |
1249 | | - |
1250 | | - <entry> |
1251 | | - <title>str -- basic_stringbuf : C++26 string_viewに対応 #1186</title> |
1252 | | - <link href="https://cpprefjp.github.io/reference/sstream/basic_stringbuf/str.html"/> |
1253 | | - <id>9ff68ed23110ce265c33182f4f0e6cb074291660:reference/sstream/basic_stringbuf/str.md</id> |
1254 | | - <updated>2025-06-12T14:54:25+09:00</updated> |
1255 | | - |
1256 | | - <summary type="html"><pre><code>diff --git a/reference/sstream/basic_stringbuf/str.md b/reference/sstream/basic_stringbuf/str.md |
1257 | | -index 3b05fee01..f09ec1573 100644 |
1258 | | ---- a/reference/sstream/basic_stringbuf/str.md |
1259 | | -+++ b/reference/sstream/basic_stringbuf/str.md |
1260 | | -@@ -19,21 +19,40 @@ template &lt;class SAlloc&gt; |
1261 | | - void str(const basic_string&lt;CharT, Traits, SAlloc&gt;&amp; s); // (5) C++20 |
1262 | | - |
1263 | | - void str(const basic_string&lt;CharT, Traits, Allocator&gt;&amp;&amp; s); // (6) C++20 |
1264 | | -+ |
1265 | | -+template&lt;class T&gt; |
1266 | | -+void str(const T&amp; t); // (7) C++26 |
1267 | | - ``` |
1268 | | - * basic_string[link /reference/string/basic_string.md] |
1269 | | - |
1270 | | - ## 概要 |
1271 | | - 文字列オブジェクトを取得または設定する。 |
1272 | | - |
1273 | | -+- (1) : 文字列オブジェクトを取得する |
1274 | | -+- (2) : 文字列オブジェクトを取得し、`SAlloc`型のアロケータ`sa`によってメモリ確保する |
1275 | | -+- (3) : 保持する文字列オブジェクトをムーブして取得する |
1276 | | -+- (4) : 文字列オブジェクト`s`を設定する |
1277 | | -+- (5) : `Allocator`に変換可能な`SAlloc`型のアロケータによって確保されているデータをコピーして、文字列オブジェクト`s`を設定する |
1278 | | -+- (6) : 与えられた文字列オブジェクト`s`をムーブして設定する |
1279 | | -+- (7) : [`basic_string_view`](/reference/string_view/basic_string_view.md)に変換可能な文字列を設定する |
1280 | | -+ |
1281 | | -+ |
1282 | | -+## テンプレートパラメータ制約 |
1283 | | -+- (7) : `is_convertible_v&lt;const T&amp;, basic_string_view&lt;CharT, Traits&gt;&gt;`が`true`であること |
1284 | | -+ |
1285 | | -+ |
1286 | | - ## 効果 |
1287 | | - - (1) : 文字列オブジェクトを取得する |
1288 | | - - (2) : 文字列オブジェクトを取得して、`SAlloc`型のアロケータ`sa`によって確保する |
1289 | | - - (3) : 保持する文字列オブジェクトをムーブして取得する |
1290 | | - - (4) : 文字列オブジェクト`s`を設定する |
1291 | | --- (5) : `SAlloc`型のアロケータによって確保されているデータをコピーして、文字列オブジェクト`s`を設定する |
1292 | | -+- (5) : `Allocator`に変換可能な`SAlloc`型のアロケータによって確保されているデータをコピーして、文字列オブジェクト`s`を設定する |
1293 | | - - (6) : 与えられた文字列オブジェクト`s`をムーブして設定する |
1294 | | -+- (7) : [`basic_string_view`](/reference/string_view/basic_string_view.md)`&lt;CharT, Traits&gt;(t)`から文字列を設定する |
1295 | | -+ |
1296 | | - |
1297 | | - ## 例 |
1298 | | -+### 基本的な使い方 |
1299 | | - ```cpp example |
1300 | | - #include &lt;iostream&gt; |
1301 | | - #include &lt;sstream&gt; |
1302 | | -@@ -64,26 +83,82 @@ int main() |
1303 | | - buf.sputc(&#39;Y&#39;); |
1304 | | - std::cout &lt;&lt; &#34;4: After writing: &#34; &lt;&lt; buf.str() &lt;&lt; std::endl; |
1305 | | - |
1306 | | -- // C++20: ムーブによる設定 |
1307 | | -- std::string s = &#34;Move test&#34;; |
1308 | | -- buf.str(std::move(s)); |
1309 | | -- std::cout &lt;&lt; &#34;5: &#34; &lt;&lt; buf.str() &lt;&lt; std::endl; |
1310 | | -+ // C++26: string_viewから設定 |
1311 | | -+ // std::string_view sv = &#34;string_view test&#34;; |
1312 | | -+ // buf.str(sv); |
1313 | | -+ // std::cout &lt;&lt; &#34;6: &#34; &lt;&lt; buf.str() &lt;&lt; std::endl; |
1314 | | - |
1315 | | - // 空文字列でクリア |
1316 | | - buf.str(&#34;&#34;); |
1317 | | -- std::cout &lt;&lt; &#34;6: Empty? &#34; &lt;&lt; (buf.str().empty() ? &#34;yes&#34; : &#34;no&#34;) &lt;&lt; std::endl; |
1318 | | -+ std::cout &lt;&lt; &#34;7: Empty? &#34; &lt;&lt; (buf.str().empty() ? &#34;yes&#34; : &#34;no&#34;) &lt;&lt; std::endl; |
1319 | | - } |
1320 | | - ``` |
1321 | | - * sputn[link /reference/streambuf/basic_streambuf/sputn.md] |
1322 | | - * sbumpc[link /reference/streambuf/basic_streambuf/sbumpc.md] |
1323 | | - * sputc[link /reference/streambuf/basic_streambuf/sputc.md] |
1324 | | - |
1325 | | --### 出力 |
1326 | | -+#### 出力 |
1327 | | - ``` |
1328 | | - 1: Hello, World! |
1329 | | - 2: New content |
1330 | | - 3: After reading 2 chars: Read/Write test |
1331 | | - 4: After writing: ReXY/Write test |
1332 | | - 5: Move test |
1333 | | --6: Empty? yes |
1334 | | -+7: Empty? yes |
1335 | | - ``` |
1336 | | -+ |
1337 | | -+#### ムーブを使用する例 (C++20) |
1338 | | -+```cpp example |
1339 | | -+#include &lt;iostream&gt; |
1340 | | -+#include &lt;sstream&gt; |
1341 | | -+ |
1342 | | -+int main() { |
1343 | | -+ std::stringbuf buf; |
1344 | | -+ |
1345 | | -+ // ムーブして文字列を設定 |
1346 | | -+ std::string s = &#34;Move string&#34;; |
1347 | | -+ buf.str(std::move(s)); |
1348 | | -+ std::cout &lt;&lt; buf.str() &lt;&lt; std::endl; |
1349 | | -+ |
1350 | | -+ // ムーブで文字列を取得 |
1351 | | -+ std::string r = std::move(buf).str(); |
1352 | | -+ std::cout &lt;&lt; r &lt;&lt; std::endl; |
1353 | | -+} |
1354 | | -+``` |
1355 | | -+ |
1356 | | -+#### 出力 |
1357 | | -+``` |
1358 | | -+Move string |
1359 | | -+Move string |
1360 | | -+``` |
1361 | | -+ |
1362 | | -+### string_viewからの設定 (C++26) |
1363 | | -+```cpp example |
1364 | | -+#include &lt;iostream&gt; |
1365 | | -+#include &lt;sstream&gt; |
1366 | | -+#include &lt;string_view&gt; |
1367 | | -+ |
1368 | | -+int main() { |
1369 | | -+ std::stringbuf buf; |
1370 | | -+ |
1371 | | -+ // 文字列リテラルを設定 |
1372 | | -+ buf.str(&#34;set from string literal&#34;); |
1373 | | -+ std::cout &lt;&lt; buf.str() &lt;&lt; std::endl; |
1374 | | -+ |
1375 | | -+ // string_viewを設定 |
1376 | | -+ std::string_view sv = &#34;set from string_view&#34;; |
1377 | | -+ buf.str(sv); |
1378 | | -+ std::cout &lt;&lt; buf.str() &lt;&lt; std::endl; |
1379 | | -+} |
1380 | | -+``` |
1381 | | -+ |
1382 | | -+#### 出力 |
1383 | | -+``` |
1384 | | -+set from string literal |
1385 | | -+set from string_view |
1386 | | -+``` |
1387 | | -+ |
1388 | | -+## 参照 |
1389 | | -+- [P0408R7 Efficient Access to `basic_stringbuf`&#39;s Buffer](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0408r7.pdf) |
1390 | | -+- [P2495R3 Interfacing stringstreams with `string_view`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2495r3.pdf) |
1391 | | -+ - C++26で[`std::string_view`](/reference/string_view/basic_string_view.md)に対応した |
1392 | | -\ No newline at end of file |
1393 | 1139 | </code></pre></summary> |
1394 | 1140 |
|
1395 | 1141 | <author> |
|
0 commit comments