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

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 23 09:53:41 PDT 2023


Author: Mark de Wever
Date: 2023-05-23T18:53:34+02:00
New Revision: ac8349832ce20398e85b4ac178c82e83a8d6ff0d

URL: https://github.com/llvm/llvm-project/commit/ac8349832ce20398e85b4ac178c82e83a8d6ff0d
DIFF: https://github.com/llvm/llvm-project/commit/ac8349832ce20398e85b4ac178c82e83a8d6ff0d.diff

LOG: [NFC][libc++][format] Uses stringstream::view.

This member has been added in D148641 so it can be used in the formatter
to avoid creating a "temporary" string.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D150791

Added: 
    

Modified: 
    libcxx/include/__chrono/formatter.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__chrono/formatter.h b/libcxx/include/__chrono/formatter.h
index 7e8af44f35d31..c0f8cb8531a66 100644
--- a/libcxx/include/__chrono/formatter.h
+++ b/libcxx/include/__chrono/formatter.h
@@ -556,9 +556,7 @@ __format_chrono(const _Tp& __value,
     }
   }
 
-  // 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


        


More information about the libcxx-commits mailing list