summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmAlgorithms.h8
-rw-r--r--Source/cmListCommand.cxx3
2 files changed, 9 insertions, 2 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index d88de1e..b9bd67b 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -302,4 +302,12 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t)
std::bind1st(std::not_equal_to<T>(), t));
}
+template<typename Range>
+ContainerAlgorithms::Range<typename Range::const_reverse_iterator>
+cmReverseRange(Range const& range)
+{
+ return ContainerAlgorithms::Range<typename Range::const_reverse_iterator>(
+ range.rbegin(), range.rend());
+}
+
#endif
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 0c6adfd..17617aa 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -390,8 +390,7 @@ bool cmListCommand
return false;
}
- std::reverse(varArgsExpanded.begin(), varArgsExpanded.end());
- std::string value = cmJoin(varArgsExpanded, ";");
+ std::string value = cmJoin(cmReverseRange(varArgsExpanded), ";");
this->Makefile->AddDefinition(listName, value.c_str());
return true;