[libcxx-commits] [PATCH] D143972: [libc++] LWG 3857: allow `string_view` conversion when only traits vary

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 13 19:17:39 PST 2023


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

The `basic_string_view` constructor accepting a contiguous range rejects
converting between `basic_string_view` even when only the trait types vary.
This prevents conversions for converting from `basic_string_view<C, T1>` and
`basic_string<C, T1, A>` to `basic_string_view<C, T2>`.  Recently, this
constructor was made `explicit`, so there's no reason to really forbid this
conversion anymore.

Relax the restriction that the trait types need to match in this constructor.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143972

Files:
  libcxx/include/string_view
  libcxx/test/std/strings/string.view/string.view.cons/from_range.pass.cpp
  libcxx/test/std/strings/string.view/string.view.cons/from_string1.compile.fail.cpp
  libcxx/test/std/strings/string.view/string.view.cons/from_string2.compile.fail.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143972.497176.patch
Type: text/x-patch
Size: 7671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230214/45ab7157/attachment.bin>


More information about the libcxx-commits mailing list