aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-12-18 15:52:33 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2018-12-18 15:52:33 +0000
commit36313a6bce37f7eabc64c66f216ff0b2adb12ed7 (patch)
tree6bfdee3d10c2cddd259f3e27e75aa615b7fd5170 /gcc
parent49cefcf3f084dabc327914269e5787bac8b20f46 (diff)
downloadgcc-36313a6bce37f7eabc64c66f216ff0b2adb12ed7.zip
gcc-36313a6bce37f7eabc64c66f216ff0b2adb12ed7.tar.gz
gcc-36313a6bce37f7eabc64c66f216ff0b2adb12ed7.tar.bz2
LWG 2936: update path::compare logic and optimize string comparisons
The resolution for LWG 2936 defines the comparison more precisely, which this patch implements. The patch also defines comparisons with strings to work without constructing a temporary path object (so avoids any memory allocations). * include/bits/fs_path.h (path::compare(const string_type&)) (path::compare(const value_type*)): Add noexcept and construct a string view to compare to instead of a path. (path::compare(basic_string_view<value_type>)): Add noexcept. Remove inline definition. * src/filesystem/std-path.cc (path::_Parser): Track last type read from input. (path::_Parser::next()): Return a final empty component when the input ends in a non-root directory separator. (path::_M_append(basic_string_view<value_type>)): Remove special cases for trailing non-root directory separator. (path::_M_concat(basic_string_view<value_type>)): Likewise. (path::compare(const path&)): Implement LWG 2936. (path::compare(basic_string_view<value_type>)): Define in terms of components returned by parser, consistent with LWG 2936. * testsuite/27_io/filesystem/path/compare/lwg2936.cc: New. * testsuite/27_io/filesystem/path/compare/path.cc: Test more cases. * testsuite/27_io/filesystem/path/compare/strings.cc: Likewise. From-SVN: r267235
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions