aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-10-15 23:53:35 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-10-15 23:53:35 -0700
commit798f8a91e43bfdeda8113639ff262f42e5ab6f84 (patch)
tree652fdc178ac911330352573d26113be78daf30b9 /toolsrc/include
parente46ec5369318f84f359af9f88cb3d517329bf088 (diff)
downloadvcpkg-798f8a91e43bfdeda8113639ff262f42e5ab6f84.tar.gz
vcpkg-798f8a91e43bfdeda8113639ff262f42e5ab6f84.zip
Introduce Vectors::concatenate()
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg/base/util.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h
index 3834580b6..4f06a8231 100644
--- a/toolsrc/include/vcpkg/base/util.h
+++ b/toolsrc/include/vcpkg/base/util.h
@@ -7,6 +7,18 @@
namespace vcpkg::Util
{
+ template<class Container>
+ using ElementT = std::remove_reference_t<decltype(*begin(std::declval<Container>()))>;
+
+ namespace Vectors
+ {
+ template<class Container, class T = ElementT<Container>>
+ void concatenate(std::vector<T>* augend, const Container& addend)
+ {
+ augend->insert(augend->end(), addend.begin(), addend.end());
+ }
+ }
+
template<class Cont, class Func>
using FmapOut = decltype(std::declval<Func>()(*begin(std::declval<Cont>())));
@@ -71,9 +83,6 @@ namespace vcpkg::Util
return std::find_if(begin(cont), end(cont), pred);
}
- template<class Container>
- using ElementT = std::remove_reference_t<decltype(*begin(std::declval<Container>()))>;
-
template<class Container, class T = ElementT<Container>>
std::vector<T*> element_pointers(Container&& cont)
{
@@ -153,4 +162,4 @@ namespace vcpkg::Util
std::unique_lock<std::mutex> m_lock;
T& m_ptr;
};
-} \ No newline at end of file
+}