diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-23 12:48:27 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-23 13:32:23 (GMT) |
commit | 999516478d56d8604d1413fe3c677a860357516c (patch) | |
tree | 6bd7a573551615d45f0b0b374b6ab1e9a65a68ad /Source/cmAlgorithms.h | |
parent | f03a80aefd4073bc1502c2e486fedfdbd8addfb6 (diff) | |
download | CMake-999516478d56d8604d1413fe3c677a860357516c.zip CMake-999516478d56d8604d1413fe3c677a860357516c.tar.gz CMake-999516478d56d8604d1413fe3c677a860357516c.tar.bz2 |
cmAlgorithms: Add cmAppend function
The new `cmAppend` function simplifies appending ranges of values to a
`std::vector`.
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r-- | Source/cmAlgorithms.h | 12 |
1 files changed, 12 insertions, 0 deletions
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<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> std::string cmJoin(Range const& r, const char* delimiter) { |