diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-10-13 21:32:14 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-10-13 22:35:32 +0100 |
commit | f874a13ca3870a56036a90758b0d41c8c217f4f7 (patch) | |
tree | 98f33bb92f926dbb4381667b941e6f52645700c5 /gcc | |
parent | ce55693604813c5be7d23260f1fd276cf5a48f8f (diff) | |
download | gcc-f874a13ca3870a56036a90758b0d41c8c217f4f7.zip gcc-f874a13ca3870a56036a90758b0d41c8c217f4f7.tar.gz gcc-f874a13ca3870a56036a90758b0d41c8c217f4f7.tar.bz2 |
libstdc++: Fix regression in memory use when constructing paths
The changes in r12-4381 were intended to reduce memory usage, but
replacing the __contiguous constant in __string_from_range with the new
__is_contiguous variable template caused a regression. The old code
checked is_pointer_v<decltype(std::__niter_base(__first))> but he new
code just checks is_pointer_v<_InputIterator>. This means that we no
longer recognise basic_string::iterator and vector::iterator as
contiguous, and so return a temporary basic_string instead of a
basic_string_view. This only affects C++17 mode, because the
std::contiguous_iterator concept is used in C++20 which gives the right
answer for __normal_iterator (and more types as well).
The fix is to specialize the new __is_contiguous variable template so it
is true for __normal_iterator<T*, C> specializations. The new partial
specializations are defined for C++20 too, because it should be cheaper
to match the partial specialization than to check whether the
std::contiguous_iterator concept is satisfied.
libstdc++-v3/ChangeLog:
* include/bits/fs_path.h (__detail::__is_contiguous): Add
partial specializations for pointers and __normal_iterator.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions