[libcxx-commits] [PATCH] D110498: [libc++][format][4/6] Improve formatted_size.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 25 11:30:24 PST 2021
Mordante marked an inline comment as done.
Mordante added inline comments.
================
Comment at: libcxx/include/__format/buffer.h:276
+
+ _LIBCPP_HIDE_FROM_ABI size_t result() && {
+ __output_.flush();
----------------
vitaut wrote:
> Why `&&`-qualified?
Not really required here, but to keep consistent with the other "retrieve result" functions in these buffers.
================
Comment at: libcxx/include/format:579-599
+template <class... _Args>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t
+formatted_size(string_view __fmt, const _Args&... __args) {
+ __format::__formatted_size_buffer<char> __buffer;
+ _VSTD::__vformat_to(__buffer.make_output_iterator(), __fmt,
+ basic_format_args{_VSTD::make_format_args(__args...)});
+
----------------
vitaut wrote:
> I suggest adding `__vformatted_size` and force-inlining `formatted_size` to reduce template bloat.
>
> Also why move this block?
It's moved so `format_to_n` can use `formatted_size`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110498/new/
https://reviews.llvm.org/D110498
More information about the libcxx-commits
mailing list