summaryrefslogtreecommitdiff
path: root/libstdc++-v3/src/c++17/fs_path.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/src/c++17/fs_path.cc')
-rw-r--r--libstdc++-v3/src/c++17/fs_path.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/libstdc++-v3/src/c++17/fs_path.cc b/libstdc++-v3/src/c++17/fs_path.cc
index 2d9e29d9e7a..506ff25f9a6 100644
--- a/libstdc++-v3/src/c++17/fs_path.cc
+++ b/libstdc++-v3/src/c++17/fs_path.cc
@@ -1907,10 +1907,9 @@ path::_M_split_cmpts()
_M_cmpts.type(_Type::_Multi);
_M_cmpts.reserve(_M_cmpts.size() + buf.size());
auto output = _M_cmpts._M_impl->end();
- for (auto& c : buf)
+ for (const auto& c : buf)
{
- auto pos = c.str.data() - _M_pathname.data();
- ::new(output++) _Cmpt(c.str, c.type, pos);
+ ::new(output++) _Cmpt(c.str, c.type, parser.offset(c));
++_M_cmpts._M_impl->_M_size;
}
next = buf.begin();
@@ -1930,9 +1929,8 @@ path::_M_split_cmpts()
auto output = _M_cmpts._M_impl->end();
for (int i = 0; i < n; ++i)
{
- auto c = buf[i];
- auto pos = c.str.data() - _M_pathname.data();
- ::new(output++) _Cmpt(c.str, c.type, pos);
+ const auto& c = buf[i];
+ ::new(output++) _Cmpt(c.str, c.type, parser.offset(c));
++_M_cmpts._M_impl->_M_size;
}
}