[libc++] Fix the return value of max_size()
authorLouis Dionne <ldionne.2@gmail.com>
Mon, 22 Nov 2021 21:44:50 +0000 (16:44 -0500)
committerLouis Dionne <ldionne.2@gmail.com>
Mon, 6 Dec 2021 18:53:25 +0000 (13:53 -0500)
commit2db67e97712e257d9784f4c3812432443f72145e
tree9ee85bc4971a05e7e66a73eea28c290e87f6380c
parenta101a9b64b31ed20e4d18c2e395b0a3742ad1836
[libc++] Fix the return value of max_size()

I assume nobody ever uses std::string_view::max_size() outside of
testing. However, we should still return a value that is based on
something with a reasonable rationale. Previously, we would forget
to take into account the size of the character type stored in the
string, and this patch takes that into account.

Thanks to @mclow.lists for pointing out this issue.

Differential Revision: https://reviews.llvm.org/D114395
libcxx/include/string_view
libcxx/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp