diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-03-17 14:36:07 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-03-17 17:51:54 +0000 |
commit | 00df7ee4474faca91d3460fe78a88e280c6c1126 (patch) | |
tree | f4ebc5e6ed672e5c9a1ef614337590794c8827b9 /libstdc++-v3/include | |
parent | 38ce4489635f2d65de965af3ec5d5c4adf7762d9 (diff) | |
download | gcc-00df7ee4474faca91d3460fe78a88e280c6c1126.tar.gz |
libstdc++: Avoid including <algorithm> in <filesystem> [PR92546]
This only affects Windows, but reduces the preprocessed size of
<filesystem> significantly.
libstdc++-v3/ChangeLog:
PR libstdc++/92546
* include/bits/fs_path.h (path::make_preferred): Use
handwritten loop instead of std::replace.
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/bits/fs_path.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index b16a878f24b..9e06fa679d8 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -52,7 +52,6 @@ #if defined(_WIN32) && !defined(__CYGWIN__) # define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1 -# include <algorithm> #endif namespace std _GLIBCXX_VISIBILITY(default) @@ -1060,8 +1059,12 @@ namespace __detail path::make_preferred() { #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS - std::replace(_M_pathname.begin(), _M_pathname.end(), L'/', - preferred_separator); + auto __pos = _M_pathname.find(L'/'); + while (__pos != _M_pathname.npos) + { + _M_pathname[__pos] = preferred_separator; + __pos = _M_pathname.find(L'/', __pos); + } #endif return *this; } |