[libcxx-commits] [PATCH] D103357: [libc++][format] Add __format_arg_store.

Victor Zverovich via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 28 11:36:20 PDT 2021


vitaut added inline comments.


================
Comment at: libcxx/include/__format/format_arg.h:144
+
+  union {
+    bool __bool;
----------------
ldionne wrote:
> Why aren't we using a `variant` here?
> 
> @vitaut I'm being told you originally requested that Mark moves from `variant` to this `union`, was there a reason? I'd like to avoid going back and forth on this issue.
Not using `variant` allows optimizing the representation for the common case of a small number of formatting arguments: http://eel.is/c++draft/format#args-note-1

> Implementations should optimize the representation of basic_­format_­args for a small number of formatting arguments.
> [Note 1: For example, by storing indices of type alternatives separately from values and packing the former. — end note]


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103357



More information about the libcxx-commits mailing list