[libcxx-commits] [PATCH] D110499: [libc++][format][5/6] Improve format_to_n.

Victor Zverovich via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 25 08:33:05 PST 2021


vitaut added inline comments.


================
Comment at: libcxx/include/format:604
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt>
 format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, string_view __fmt,
             const _Args&... __args) {
----------------
Similarly to other diffs, let's introduce `__vformat_to_n` and force inline `format_to_n` for bloat prevention to actually work.


================
Comment at: libcxx/include/format:606-608
+  if (__n <= 0) [[unlikely]]
+    return {_VSTD::move(__out_it),
+            iter_difference_t<_OutIt>(formatted_size(__fmt, __args...))};
----------------
Not sure if this branch is worth adding. `__format_to_n_buffer` should perform reasonably well for this case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110499/new/

https://reviews.llvm.org/D110499



More information about the libcxx-commits mailing list