cmAlgorithms: Add cmReverseRange adaptor.

Use it to implement list(REVERSE).
This commit is contained in:
Stephen Kelly 2015-02-17 22:04:25 +01:00
parent a3a0a8c222
commit 4afe6c26c6
2 changed files with 9 additions and 2 deletions

View File

@ -302,4 +302,12 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t)
std::bind1st(std::not_equal_to<T>(), 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 #endif

View File

@ -390,8 +390,7 @@ bool cmListCommand
return false; return false;
} }
std::reverse(varArgsExpanded.begin(), varArgsExpanded.end()); std::string value = cmJoin(cmReverseRange(varArgsExpanded), ";");
std::string value = cmJoin(varArgsExpanded, ";");
this->Makefile->AddDefinition(listName, value.c_str()); this->Makefile->AddDefinition(listName, value.c_str());
return true; return true;