[libcxx-commits] [PATCH] D141263: [libc++][test] Silence MSVC warning

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 9 03:08:13 PST 2023


philnik accepted this revision.
philnik added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: libcxx/test/std/ranges/range.factories/range.istream.view/utils.h:9
 auto make_string(const char (&in)[N]) {
-  std::basic_string<CharT> r(N - 1, static_cast<CharT>(0));
-  for (std::size_t i = 0; i < N - 1; ++i) {
-    r[i] = static_cast<CharT>(in[i]);
-  }
-  return r;
+  return std::basic_string<CharT>(in + 0, in + (N - 1));
 }
----------------
Seems even simpler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141263



More information about the libcxx-commits mailing list