- format[meta header]
- function template[meta id-type]
- std[meta namespace]
- cpp26[meta cpp]
namespace std {
runtime-format-string<char>
runtime_format(string_view fmt) noexcept; // (1) C++26
runtime-format-string<wchar_t>
runtime_format(wstring_view fmt) noexcept; // (2) C++26
}
- runtime-format-string[link runtime-format-string.md]
- wstring_view[link /reference/string_view/basic_string_view.md]
実行時文字列を書式文字列として使用できるようラップする。
このクラスは、std::string
やstd::string_view
の文字列を、書式文字列としてstd::format()
関数に指定するための型に変換する関数である。
return fmt;
#include <print>
int main()
{
std::string fmt = "{}";
std::string s = std::format(std::runtime_format(fmt), "Hello");
std::println(std::runtime_format(fmt), s);
}
- std::runtime_format[color ff0000]
- std::format[link format.md]
Hello
- C++26
- Clang: ??
- GCC: 14
- Visual C++: ??