summaryrefslogtreecommitdiffstats
path: root/Source/cmRST.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-02-02 01:13:54 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-02-20 20:36:58 (GMT)
commitbb9d71b4fee2cc4abf55e0dcbadf85c6cbe0d07d (patch)
tree94ea3820542301f5329e16cb1f0477470d693225 /Source/cmRST.cxx
parent4afe6c26c66556827e6089982c49b8dea3a2efcb (diff)
downloadCMake-bb9d71b4fee2cc4abf55e0dcbadf85c6cbe0d07d.zip
CMake-bb9d71b4fee2cc4abf55e0dcbadf85c6cbe0d07d.tar.gz
CMake-bb9d71b4fee2cc4abf55e0dcbadf85c6cbe0d07d.tar.bz2
Replace loops with algorithms.
Diffstat (limited to 'Source/cmRST.cxx')
-rw-r--r--Source/cmRST.cxx17
1 files changed, 5 insertions, 12 deletions
diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx
index c261d57..cb61ed9 100644
--- a/Source/cmRST.cxx
+++ b/Source/cmRST.cxx
@@ -484,19 +484,12 @@ void cmRST::UnindentLines(std::vector<std::string>& lines)
}
}
- // Drop leading blank lines.
- size_t leadingEmpty = 0;
- for(size_t i = 0; i < lines.size() && lines[i].empty(); ++i)
- {
- ++leadingEmpty;
- }
+ std::vector<std::string>::const_iterator it = lines.begin();
+ size_t leadingEmpty = std::distance(it, cmFindNot(lines, std::string()));
- // Drop trailing blank lines.
- size_t trailingEmpty = 0;
- for(size_t i = lines.size(); i > 0 && lines[i-1].empty(); --i)
- {
- ++trailingEmpty;
- }
+ std::vector<std::string>::const_reverse_iterator rit = lines.rbegin();
+ size_t trailingEmpty = std::distance(rit,
+ cmFindNot(cmReverseRange(lines), std::string()));
std::vector<std::string>::iterator contentEnd
= cmRotate(lines.begin(),