Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.4 KB

runtime-format-string.md

File metadata and controls

50 lines (36 loc) · 1.4 KB

runtime-format-string

  • format[meta header]
  • class[meta id-type]
  • std[meta namespace]
  • cpp26[meta cpp]
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");
  • std::format[link format.md]
  • std::runtime_format[link runtime_format.md]

バージョン

言語

  • C++26

関連項目

参照