Skip to content

Commit 18c3258

Browse files
committed
P2918R2 Runtime format strings II
1 parent ecbeb5a commit 18c3258

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

source/support.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@
631631
#define @\defnlibxname{cpp_lib_filesystem}@ 201703L // also in \libheader{filesystem}
632632
#define @\defnlibxname{cpp_lib_flat_map}@ 202207L // also in \libheader{flat_map}
633633
#define @\defnlibxname{cpp_lib_flat_set}@ 202207L // also in \libheader{flat_set}
634-
#define @\defnlibxname{cpp_lib_format}@ 202306L // also in \libheader{format}
634+
#define @\defnlibxname{cpp_lib_format}@ 202311L // also in \libheader{format}
635635
#define @\defnlibxname{cpp_lib_format_ranges}@ 202207L // also in \libheader{format}
636636
#define @\defnlibxname{cpp_lib_formatters}@ 202302L // also in \libheader{stacktrace}, \libheader{thread}
637637
#define @\defnlibxname{cpp_lib_forward_like}@ 202207L // freestanding, also in \libheader{utility}

source/utilities.tex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15528,6 +15528,17 @@
1552815528
template<class charT, class... Args>
1552915529
struct basic_format_string;
1553015530

15531+
template<class charT> struct @\exposid{runtime-format-string}@ { // \expos
15532+
private:
15533+
basic_string_view<charT> @\exposid{str}@; // \expos
15534+
public:
15535+
@\exposid{runtime-format-string}@(basic_string_view<charT> s) noexcept : @\exposid{str}@(s) {}
15536+
@\exposid{runtime-format-string}@(const @\exposid{runtime-format-string}@&) = delete;
15537+
const @\exposid{runtime-format-string}@& operator=(const @\exposid{runtime-format-string}@&) = delete;
15538+
};
15539+
@\exposid{runtime-format-string}@<char> runtime_format(string_view fmt) noexcept { return fmt; }
15540+
@\exposid{runtime-format-string}@<wchar_t> runtime_format(wstring_view fmt) noexcept { return fmt; }
15541+
1553115542
template<class... Args>
1553215543
using @\libglobal{format_string}@ = basic_format_string<char, type_identity_t<Args>...>;
1553315544
template<class... Args>
@@ -16430,6 +16441,7 @@
1643016441

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

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

0 commit comments

Comments
 (0)