From 999516478d56d8604d1413fe3c677a860357516c Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Thu, 23 May 2019 14:48:27 +0200 Subject: cmAlgorithms: Add cmAppend function The new `cmAppend` function simplifies appending ranges of values to a `std::vector`. --- Source/cmAlgorithms.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 0980416..d1e32b0 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -171,6 +171,18 @@ void cmDeleteAll(Range const& r) ContainerAlgorithms::DefaultDeleter()); } +template +void cmAppend(std::vector& v, Range const& r) +{ + v.insert(v.end(), r.begin(), r.end()); +} + +template +void cmAppend(std::vector& v, InputIt first, InputIt last) +{ + v.insert(v.end(), first, last); +} + template std::string cmJoin(Range const& r, const char* delimiter) { -- cgit v0.12