[libcxx-commits] [PATCH] D153336: [libc++] Fixes thread::id's operator<<.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 11 10:51:33 PDT 2023
ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.
Thanks for fixing this! LGTM w/ comments applied and green CI. Also make sure to rebase cause I made some changes to `__thread/`.
================
Comment at: libcxx/include/__thread/thread.h:136
+operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {
+ // [thread.thread.id]/9
+ // Effects: Inserts the text representation for charT of id into out.
----------------
I think this whole comment could actually be changed to:
```
// [thread.thread.id]/9
// Effects: Inserts the text representation for charT of id into out.
//
// [thread.thread.id]/2
// The text representation for the character type charT of an
// object of type thread::id is an unspecified sequence of charT
// such that, for two objects of type thread::id x and y, if
// x == y is true, the thread::id objects have the same text
// representation, and if x != y is true, the thread::id objects
// have distinct text representations.
//
// Since various flags in the output stream can affect how the
// thread id is represented (e.g. numpunct or showbase), we
// use a temporary stream instead and just output the thread
// id representation as a string.
```
================
Comment at: libcxx/include/__thread/thread.h:160
+ // a known state and restore it afterwards. This gets quite
+ // complicated, instead a temporary in a known state is created.
+
----------------
================
Comment at: libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp:84-85
+ assert(expected == format<CharT>(std::ios_base::showpos));
+ assert(expected == format<CharT>(std::ios_base::skipws)); // added for completion
+ assert(expected == format<CharT>(std::ios_base::unitbuf)); // added for completion
+ assert(expected == format<CharT>(std::ios_base::uppercase));
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153336/new/
https://reviews.llvm.org/D153336
More information about the libcxx-commits
mailing list