Skip to content

Commit

Permalink
P2918R2 Runtime format strings II
Browse files Browse the repository at this point in the history
  • Loading branch information
burblebee committed Nov 14, 2023
1 parent ecbeb5a commit 18c3258
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@
#define @\defnlibxname{cpp_lib_filesystem}@ 201703L // also in \libheader{filesystem}
#define @\defnlibxname{cpp_lib_flat_map}@ 202207L // also in \libheader{flat_map}
#define @\defnlibxname{cpp_lib_flat_set}@ 202207L // also in \libheader{flat_set}
#define @\defnlibxname{cpp_lib_format}@ 202306L // also in \libheader{format}
#define @\defnlibxname{cpp_lib_format}@ 202311L // also in \libheader{format}
#define @\defnlibxname{cpp_lib_format_ranges}@ 202207L // also in \libheader{format}
#define @\defnlibxname{cpp_lib_formatters}@ 202302L // also in \libheader{stacktrace}, \libheader{thread}
#define @\defnlibxname{cpp_lib_forward_like}@ 202207L // freestanding, also in \libheader{utility}
Expand Down
12 changes: 12 additions & 0 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15528,6 +15528,17 @@
template<class charT, class... Args>
struct basic_format_string;

template<class charT> struct @\exposid{runtime-format-string}@ { // \expos
private:
basic_string_view<charT> @\exposid{str}@; // \expos
public:
@\exposid{runtime-format-string}@(basic_string_view<charT> s) noexcept : @\exposid{str}@(s) {}
@\exposid{runtime-format-string}@(const @\exposid{runtime-format-string}@&) = delete;
const @\exposid{runtime-format-string}@& operator=(const @\exposid{runtime-format-string}@&) = delete;
};
@\exposid{runtime-format-string}@<char> runtime_format(string_view fmt) noexcept { return fmt; }
@\exposid{runtime-format-string}@<wchar_t> runtime_format(wstring_view fmt) noexcept { return fmt; }

template<class... Args>
using @\libglobal{format_string}@ = basic_format_string<char, type_identity_t<Args>...>;
template<class... Args>
Expand Down Expand Up @@ -16430,6 +16441,7 @@

public:
template<class T> consteval basic_format_string(const T& s);
basic_format_string(@\exposid{runtime-format-string}@<charT> s) noexcept : str(s.@\exposid{str}@) {}

constexpr basic_string_view<charT> get() const noexcept { return @\exposid{str}@; }
};
Expand Down

0 comments on commit 18c3258

Please sign in to comment.