r267235 - in /trunk/libstdc++-v3: ChangeLog inc...

redi@gcc.gnu.org redi@gcc.gnu.org
Tue Dec 18 15:52:00 GMT 2018


Author: redi
Date: Tue Dec 18 15:52:33 2018
New Revision: 267235

URL: https://gcc.gnu.org/viewcvs?rev=267235&root=gcc&view=rev
Log:
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.

Added:
    trunk/libstdc++-v3/testsuite/27_io/filesystem/path/compare/lwg2936.cc
      - copied, changed from r267234, trunk/libstdc++-v3/testsuite/27_io/filesystem/path/compare/strings.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/fs_path.h
    trunk/libstdc++-v3/src/filesystem/std-path.cc
    trunk/libstdc++-v3/testsuite/27_io/filesystem/path/compare/path.cc
    trunk/libstdc++-v3/testsuite/27_io/filesystem/path/compare/strings.cc



More information about the Libstdc++-cvs mailing list