mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-15 22:35:33 -05:00
cmMakefile::FormatListFileStack: Refactor "manual" loop into algorithms
This commit is contained in:
@@ -4265,20 +4265,14 @@ std::string cmMakefile::FormatListFileStack() const
|
||||
return {};
|
||||
}
|
||||
|
||||
std::reverse(listFiles.begin(), listFiles.end());
|
||||
std::ostringstream tmp;
|
||||
size_t depth = listFiles.size();
|
||||
auto it = listFiles.end();
|
||||
do {
|
||||
if (depth != listFiles.size()) {
|
||||
tmp << "\n ";
|
||||
}
|
||||
--it;
|
||||
tmp << '[' << depth << "]\t" << *it;
|
||||
depth--;
|
||||
} while (it != listFiles.begin());
|
||||
auto depth = 1;
|
||||
std::transform(listFiles.begin(), listFiles.end(), listFiles.begin(),
|
||||
[&depth](const std::string& file) {
|
||||
return cmStrCat('[', depth++, "]\t", file);
|
||||
});
|
||||
|
||||
return tmp.str();
|
||||
return cmJoinStrings(cmMakeRange(listFiles.rbegin(), listFiles.rend()),
|
||||
"\n "_s, {});
|
||||
}
|
||||
|
||||
void cmMakefile::PushScope()
|
||||
|
||||
Reference in New Issue
Block a user