[libcxx-commits] [PATCH] D110497: [libc++][format][3/6] Adds a __container_buffer.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 26 06:48:51 PDT 2021


Mordante created this revision.
Mordante added reviewers: ldionne, vitaut.
Herald added a subscriber: mgorny.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Instead of writing every character directly into the container by using
a `back_insert_iterator` the data is buffered in an `array`. This buffer
is then inserted to the container by calling its `insert` member function.

Since there's no guarantee every container's `insert` behaves properly
containers need to opt-in to this behaviour. The appropriate standard
containers opt-in to this behaviour.

This change improves the performance of the format functions that use a
`back_insert_iterator`.

Depends on D110495 <https://reviews.llvm.org/D110495>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110497

Files:
  libcxx/include/CMakeLists.txt
  libcxx/include/__format/buffer.h
  libcxx/include/__format/enable_insertable.h
  libcxx/include/deque
  libcxx/include/format
  libcxx/include/list
  libcxx/include/module.modulemap
  libcxx/include/string
  libcxx/include/vector
  libcxx/test/libcxx/diagnostics/detail.headers/format/enable_insertable.module.verify.cpp
  libcxx/test/libcxx/utilities/format/enable_insertable.compile.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110497.375096.patch
Type: text/x-patch
Size: 18301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210926/b7a07756/attachment-0001.bin>


More information about the libcxx-commits mailing list