mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-04-21 13:39:31 +08:00
refs #90, small optimizations
This commit is contained in:
parent
ff271edfee
commit
75c647f327
@ -10,3 +10,8 @@ add_executable(fs_du du.cpp)
|
|||||||
target_link_libraries(fs_du ghc_filesystem)
|
target_link_libraries(fs_du ghc_filesystem)
|
||||||
AddExecutableWithStdFS(std_fs_du du.cpp)
|
AddExecutableWithStdFS(std_fs_du du.cpp)
|
||||||
|
|
||||||
|
if(EXISTS "${PROJECT_SOURCE_DIR}/examples/benchmark.cpp")
|
||||||
|
add_executable(fs_benchmark benchmark.cpp)
|
||||||
|
set_property(TARGET fs_benchmark PROPERTY CXX_STANDARD 17)
|
||||||
|
target_link_libraries(fs_benchmark ghc_filesystem)
|
||||||
|
endif()
|
@ -2850,7 +2850,7 @@ GHC_INLINE path path::parent_path() const
|
|||||||
{
|
{
|
||||||
auto rootPathLen = _prefixLength + root_name_length() + (has_root_directory() ? 1 : 0);
|
auto rootPathLen = _prefixLength + root_name_length() + (has_root_directory() ? 1 : 0);
|
||||||
if (rootPathLen < _path.length()) {
|
if (rootPathLen < _path.length()) {
|
||||||
if (empty() || begin() == --end()) {
|
if (empty()) {
|
||||||
return path();
|
return path();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -3068,7 +3068,9 @@ GHC_INLINE path::iterator::iterator(const path& p, const impl_string_type::const
|
|||||||
, _root(p.has_root_directory() ? _first + static_cast<string_type::difference_type>(p._prefixLength + p.root_name_length()) : _last)
|
, _root(p.has_root_directory() ? _first + static_cast<string_type::difference_type>(p._prefixLength + p.root_name_length()) : _last)
|
||||||
, _iter(pos)
|
, _iter(pos)
|
||||||
{
|
{
|
||||||
updateCurrent();
|
if(pos != _last) {
|
||||||
|
updateCurrent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GHC_INLINE path::impl_string_type::const_iterator path::iterator::increment(const path::impl_string_type::const_iterator& pos) const
|
GHC_INLINE path::impl_string_type::const_iterator path::iterator::increment(const path::impl_string_type::const_iterator& pos) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user