[llvm-branch-commits] [libcxx] [libc++][format][5/7] Improve std::format_to_n (PR #101831)

Louis Dionne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 3 08:46:52 PDT 2024


================
@@ -56,6 +57,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace __format {
 
+// A helper to limit the total size of code units written.
+class _LIBCPP_HIDE_FROM_ABI __max_output_size {
+public:
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit __max_output_size(size_t __max_size) : __max_size_{__max_size} {}
+
+  // This function adjusts the size of a (bulk) write operations. It ensures the
+  // number of code units written by a __output_buffer never exceed
----------------
ldionne wrote:

```suggestion
  // number of code units written by a __output_buffer never exceeds
```

https://github.com/llvm/llvm-project/pull/101831


More information about the llvm-branch-commits mailing list