From 82373d84bc49b2ac48b50df37dce8222b447bc5f Mon Sep 17 00:00:00 2001 From: cycloawaodorin Date: Wed, 25 Mar 2026 19:50:55 +0900 Subject: [PATCH 1/3] =?UTF-8?q?P2905R2=20=E3=81=AB=E3=82=88=E3=82=8A?= =?UTF-8?q?=EF=BC=8Cmake=5Fformat=5Fargs=20=E3=81=AF=E5=B7=A6=E8=BE=BA?= =?UTF-8?q?=E5=80=A4=E3=81=97=E3=81=8B=E5=8F=97=E3=81=91=E5=8F=96=E3=82=89?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=81=9F=E3=82=81=EF=BC=8C=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=83=91=E3=82=A4=E3=83=AB=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=A8?= =?UTF-8?q?=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E4=BE=8B=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reference/format/make_format_args.md | 12 +++++++----- reference/format/vformat.md | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/reference/format/make_format_args.md b/reference/format/make_format_args.md index 4f4484a98a..60dc5e62da 100644 --- a/reference/format/make_format_args.md +++ b/reference/format/make_format_args.md @@ -9,17 +9,17 @@ namespace std { template format_arg_store - make_format_args(Args&&... args); // (1) C++20 + make_format_args(Args&... args); // (1) C++20 template constexpr format_arg_store - make_format_args(Args&&... args); // (1) C++26 + make_format_args(Args&... args); // (1) C++26 template format_arg_store - make_wformat_args(Args&&... args); // (2) C++20 + make_wformat_args(Args&... args); // (2) C++20 template constexpr format_arg_store - make_wformat_args(Args&&... args); // (2) C++26 + make_wformat_args(Args&... args); // (2) C++26 } ``` * format_arg_store[italic] @@ -79,7 +79,8 @@ return make_format_args(args...); int main() { std::string fmt = "0x{:x} 0b{:04b}"; - std::string s = std::vformat(fmt, std::make_format_args(10, 6)); + int m=10, n=6; + std::string s = std::vformat(fmt, std::make_format_args(m, n)); std::cout << s << std::endl; } ``` @@ -124,3 +125,4 @@ namespace std { * [P0645R10 Text Formatting](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0645r10.html) * [P2418R2 Add support for `std::generator`-like types to `std::format`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2418r2.html) +* [P2905R2 Runtime format strings](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2905r2.html) diff --git a/reference/format/vformat.md b/reference/format/vformat.md index 3ecbc595be..160b8cbbb1 100644 --- a/reference/format/vformat.md +++ b/reference/format/vformat.md @@ -70,7 +70,8 @@ C++26以降は、実行時文字列のフォーマット引数を使用したい int main() { std::string fmt = "0x{:x} 0b{:04b}"; - std::string s = std::vformat(fmt, std::make_format_args(10, 6)); + int m=10, n=6; + std::string s = std::vformat(fmt, std::make_format_args(m, n)); std::cout << s << std::endl; } ``` @@ -132,5 +133,6 @@ string vformat(const locale& loc, wstring_view fmt, wformat_args args) { - [Working Draft, Standard for Programming Language C++ [format]](https://timsong-cpp.github.io/cppwp/format) - [P0645R10 Text Formatting](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0645r10.html) +- [P2905R2 Runtime format strings](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2905r2.html) - [P3391R2 `constexpr std::format`](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3391r2.html) - C++26から非ロケール版が`constexpr`に対応した From c051f6437473be6e84242de37d476e3a25c4f777 Mon Sep 17 00:00:00 2001 From: KAZOON <48007342+cycloawaodorin@users.noreply.github.com> Date: Thu, 26 Mar 2026 08:18:29 +0900 Subject: [PATCH 2/3] Update reference/format/vformat.md Co-authored-by: Koichi Murase --- reference/format/vformat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/format/vformat.md b/reference/format/vformat.md index 160b8cbbb1..113ee744a6 100644 --- a/reference/format/vformat.md +++ b/reference/format/vformat.md @@ -70,7 +70,7 @@ C++26以降は、実行時文字列のフォーマット引数を使用したい int main() { std::string fmt = "0x{:x} 0b{:04b}"; - int m=10, n=6; + int m = 10, n = 6; std::string s = std::vformat(fmt, std::make_format_args(m, n)); std::cout << s << std::endl; } From 2988ba75cebca2e5959154ce5eff0dd8703c5f20 Mon Sep 17 00:00:00 2001 From: cycloawaodorin Date: Thu, 26 Mar 2026 08:40:26 +0900 Subject: [PATCH 3/3] =?UTF-8?q?P2905R2=20=E3=81=AB=E9=96=A2=E3=81=99?= =?UTF-8?q?=E3=82=8B=E7=B0=A1=E5=8D=98=E3=81=AA=E8=AA=AC=E6=98=8E=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reference/format/make_format_args.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reference/format/make_format_args.md b/reference/format/make_format_args.md index 60dc5e62da..326ca50e8a 100644 --- a/reference/format/make_format_args.md +++ b/reference/format/make_format_args.md @@ -79,7 +79,7 @@ return make_format_args(args...); int main() { std::string fmt = "0x{:x} 0b{:04b}"; - int m=10, n=6; + int m = 10, n = 6; std::string s = std::vformat(fmt, std::make_format_args(m, n)); std::cout << s << std::endl; } @@ -126,3 +126,4 @@ namespace std { * [P0645R10 Text Formatting](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0645r10.html) * [P2418R2 Add support for `std::generator`-like types to `std::format`](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2418r2.html) * [P2905R2 Runtime format strings](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2905r2.html) + * C++23 発効後の DR として、引数を非 `const` 左辺値参照とすることで、一時オブジェクトを渡すことによる寿命切れオブジェクトの参照を回避する変更が提案された。これは C++20 まで遡及適用された。