Refactor path construction from null terminated iterator ranges
commit861db1097d3f013ba2534316f15d65e1442c8798
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 May 2018 22:48:51 +0000 (23 22:48 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 May 2018 22:48:51 +0000 (23 22:48 +0000)
treed08da15f28a50c0b6346de87dbfc4b14d3327da7
parentac6b1c285eaf4d26de4d80d499eada7e6588aae2
Refactor path construction from null terminated iterator ranges

Move duplicated code to new _S_string_from_iter function and fix
constraints to accept iterators with const value type.

* include/bits/fs_path.h (path::__is_encoded_char): Change from class
template to alias template.
(path::__value_type_is_char): Use remove_const_t.
(path:_S_string_from_iter): New helper function.
(path::_S_convert(InputIter, __null_terminated))
(path::_S_convert_loc(InputIter, __null_terminated, const locale&)):
Use _S_string_from_iter.
(path::string<_CharT, _Allocator>(const _Allocator&)): Allow sharing
rep for COW strings.
* include/experimental/bits/fs_path.h (path::__is_encoded_char):
Change from class template to alias template.
(path::__value_type_is_char): Use remove_const.
(path:_S_string_from_iter): New helper function.
(path::_S_convert(InputIter, __null_terminated))
(path::_S_convert_loc(InputIter, __null_terminated, const locale&)):
Use _S_string_from_iter.
* testsuite/27_io/filesystem/path/append/source.cc: Test appending
wide strings.
* testsuite/27_io/filesystem/path/concat/strings.cc: Check for exact
string equality, not path equivalence.
* testsuite/27_io/filesystem/path/construct/format.cc: Check
construction from std::string and std::wstring and input iterators.
* testsuite/27_io/filesystem/path/construct/locale.cc: Check
construction from iterators.
* testsuite/experimental/filesystem/path/concat/strings.cc: Check for
exact string equality, not path equivalence.
* testsuite/experimental/filesystem/path/construct/locale.cc: Check
construction from iterators.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260628 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fs_path.h
libstdc++-v3/include/experimental/bits/fs_path.h
libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc
libstdc++-v3/testsuite/27_io/filesystem/path/concat/strings.cc
libstdc++-v3/testsuite/27_io/filesystem/path/construct/format.cc
libstdc++-v3/testsuite/27_io/filesystem/path/construct/locale.cc
libstdc++-v3/testsuite/experimental/filesystem/path/concat/strings.cc
libstdc++-v3/testsuite/experimental/filesystem/path/construct/locale.cc