最終更新日時(UTC):
が更新

履歴 編集

class
<format>

std::runtime-format-string(C++26)

namespace std {

template <class charT>
struct runtime-format-string {
private:
  basic_string_view<charT> str;  // 説明用

public:
  runtime-format-string(basic_string_view<charT> s) noexcept : str(s) {}

  runtime-format-string(const runtime-format-string&) = delete;
  const runtime-format-string& operator=(const runtime-format-string&) = delete;
};

}

概要

runtime-format-stringクラスは、実行時の書式文字列を表す説明用のクラスであり、ユーザーは使用できない。

このクラスは、std::stringstd::string_viewの文字列を、書式文字列としてstd::format()関数に指定するためにある。

std::string fmt = "{}";
std::string s = std::format(std::runtime_format(fmt), "Hello");

バージョン

言語

  • C++26

関連項目

参照