diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2019-11-07 17:19:49 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2019-11-11 09:57:58 (GMT) |
commit | 101b5288ffa988b86fc1fe83f3ff65c9694b1484 (patch) | |
tree | 8ef92a32b381800b9798877e0cea19e712e25fee /Source/cmAlgorithms.h | |
parent | eb306700d536849c4125d4a9b84e0bd40b4f2844 (diff) | |
download | CMake-101b5288ffa988b86fc1fe83f3ff65c9694b1484.zip CMake-101b5288ffa988b86fc1fe83f3ff65c9694b1484.tar.gz CMake-101b5288ffa988b86fc1fe83f3ff65c9694b1484.tar.bz2 |
cmAlgorithm: Extend cmAppend capabilities
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r-- | Source/cmAlgorithms.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index e0d27ee..e83f160 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -8,6 +8,7 @@ #include <algorithm> #include <functional> #include <iterator> +#include <memory> #include <unordered_set> #include <utility> #include <vector> @@ -144,6 +145,13 @@ void cmDeleteAll(Range const& r) ContainerAlgorithms::DefaultDeleter<Range>()); } +template <typename T> +void cmAppend(std::vector<T*>& v, std::vector<std::unique_ptr<T>> const& r) +{ + std::transform(r.begin(), r.end(), std::back_inserter(v), + [](const std::unique_ptr<T>& item) { return item.get(); }); +} + template <typename T, typename Range> void cmAppend(std::vector<T>& v, Range const& r) { |