[libcxx-commits] [PATCH] D150791: [NFC][libc++][format] Uses stringstream::view.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 17 08:39:24 PDT 2023


Mordante created this revision.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

This member has been added in D148641 <https://reviews.llvm.org/D148641> so it can be used in the formatter
to avoid creating a "temporary" string.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150791

Files:
  libcxx/include/__chrono/formatter.h


Index: libcxx/include/__chrono/formatter.h
===================================================================
--- libcxx/include/__chrono/formatter.h
+++ libcxx/include/__chrono/formatter.h
@@ -556,9 +556,7 @@
     }
   }
 
-  // TODO FMT Use the stringstream's view after P0408R7 has been implemented.
-  basic_string<_CharT> __str = __sstr.str();
-  return __formatter::__write_string(basic_string_view<_CharT>{__str}, __ctx.out(), __specs);
+  return __formatter::__write_string(__sstr.view(), __ctx.out(), __specs);
 }
 
 } // namespace __formatter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150791.523065.patch
Type: text/x-patch
Size: 554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230517/ea0d6f89/attachment-0001.bin>


More information about the libcxx-commits mailing list