mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-13 06:29:47 -04:00
Refactorings
This commit is contained in:
parent
6841823de9
commit
928f45adf2
@ -21,9 +21,7 @@ path::path(const std::string& path){
|
|||||||
auto parts = std::split(path, '/');
|
auto parts = std::split(path, '/');
|
||||||
names.reserve(names.size() + parts.size());
|
names.reserve(names.size() + parts.size());
|
||||||
|
|
||||||
for(auto& part : parts){
|
std::copy(parts.begin(), parts.end(), std::back_inserter(names));
|
||||||
names.push_back(part);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
path::path(const path& base_path, const std::string& p){
|
path::path(const path& base_path, const std::string& p){
|
||||||
@ -32,13 +30,8 @@ path::path(const path& base_path, const std::string& p){
|
|||||||
auto parts = std::split(p, '/');
|
auto parts = std::split(p, '/');
|
||||||
names.reserve(names.size() + base_path.size() + parts.size());
|
names.reserve(names.size() + base_path.size() + parts.size());
|
||||||
|
|
||||||
for(auto& part : base_path){
|
std::copy(base_path.begin(), base_path.end(), std::back_inserter(names));
|
||||||
names.push_back(part);
|
std::copy(parts.begin(), parts.end(), std::back_inserter(names));
|
||||||
}
|
|
||||||
|
|
||||||
for(auto& part : parts){
|
|
||||||
names.push_back(part);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
path::path(const path& base_path, const path& p){
|
path::path(const path& base_path, const path& p){
|
||||||
@ -46,13 +39,8 @@ path::path(const path& base_path, const path& p){
|
|||||||
|
|
||||||
names.reserve(names.size() + base_path.size() + p.size());
|
names.reserve(names.size() + base_path.size() + p.size());
|
||||||
|
|
||||||
for(auto& part : base_path){
|
std::copy(base_path.begin(), base_path.end(), std::back_inserter(names));
|
||||||
names.push_back(part);
|
std::copy(p.begin(), p.end(), std::back_inserter(names));
|
||||||
}
|
|
||||||
|
|
||||||
for(auto& part : p){
|
|
||||||
names.push_back(part);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Ideally, the last / should not be used
|
// TODO Ideally, the last / should not be used
|
||||||
|
Loading…
x
Reference in New Issue
Block a user