Replace loops with algorithms.
This commit is contained in:
parent
4afe6c26c6
commit
bb9d71b4fe
|
@ -484,19 +484,12 @@ void cmRST::UnindentLines(std::vector<std::string>& lines)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drop leading blank lines.
|
std::vector<std::string>::const_iterator it = lines.begin();
|
||||||
size_t leadingEmpty = 0;
|
size_t leadingEmpty = std::distance(it, cmFindNot(lines, std::string()));
|
||||||
for(size_t i = 0; i < lines.size() && lines[i].empty(); ++i)
|
|
||||||
{
|
|
||||||
++leadingEmpty;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop trailing blank lines.
|
std::vector<std::string>::const_reverse_iterator rit = lines.rbegin();
|
||||||
size_t trailingEmpty = 0;
|
size_t trailingEmpty = std::distance(rit,
|
||||||
for(size_t i = lines.size(); i > 0 && lines[i-1].empty(); --i)
|
cmFindNot(cmReverseRange(lines), std::string()));
|
||||||
{
|
|
||||||
++trailingEmpty;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string>::iterator contentEnd
|
std::vector<std::string>::iterator contentEnd
|
||||||
= cmRotate(lines.begin(),
|
= cmRotate(lines.begin(),
|
||||||
|
|
Loading…
Reference in New Issue