mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 21:30:01 -05:00
cmAlgorithms: Add cmAppend function
The new `cmAppend` function simplifies appending ranges of values to a `std::vector`.
This commit is contained in:
@@ -171,6 +171,18 @@ void cmDeleteAll(Range const& r)
|
|||||||
ContainerAlgorithms::DefaultDeleter<Range>());
|
ContainerAlgorithms::DefaultDeleter<Range>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, typename Range>
|
||||||
|
void cmAppend(std::vector<T>& v, Range const& r)
|
||||||
|
{
|
||||||
|
v.insert(v.end(), r.begin(), r.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename InputIt>
|
||||||
|
void cmAppend(std::vector<T>& v, InputIt first, InputIt last)
|
||||||
|
{
|
||||||
|
v.insert(v.end(), first, last);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Range>
|
template <typename Range>
|
||||||
std::string cmJoin(Range const& r, const char* delimiter)
|
std::string cmJoin(Range const& r, const char* delimiter)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user