roar
Loading...
Searching...
No Matches
concat_containers.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <iterator>
4
5namespace Roar
6{
7 template <template <typename...> typename ContainerType, typename ElementType>
8 void concatContainers(ContainerType<ElementType>& lhs, ContainerType<ElementType> const& rhs)
9 {
10 lhs.reserve(lhs.size() + rhs.size());
11 lhs.insert(std::end(lhs), std::begin(rhs), std::end(rhs));
12 }
13
14 template <template <typename...> typename ContainerType, typename ElementType>
15 void concatContainers(ContainerType<ElementType>& lhs, ContainerType<ElementType>&& rhs)
16 {
17 lhs.reserve(lhs.size() + rhs.size());
18 lhs.insert(std::end(lhs), std::make_move_iterator(std::begin(rhs)), std::make_move_iterator(std::end(rhs)));
19 }
20
21 template <template <typename...> typename ContainerType, typename ElementType>
22 ContainerType<ElementType>
23 concatContainersCopy(ContainerType<ElementType> lhs, ContainerType<ElementType> const& rhs)
24 {
25 lhs.reserve(lhs.size() + rhs.size());
26 lhs.insert(std::end(lhs), std::begin(rhs), std::end(rhs));
27 return lhs;
28 }
29
30 template <template <typename...> typename ContainerType, typename ElementType>
31 ContainerType<ElementType> concatContainersCopy(ContainerType<ElementType> lhs, ContainerType<ElementType>&& rhs)
32 {
33 lhs.reserve(lhs.size() + rhs.size());
34 lhs.insert(std::end(lhs), std::make_move_iterator(std::begin(rhs)), std::make_move_iterator(std::end(rhs)));
35 return lhs;
36 }
37} // namespace Roar
Definition authorization.hpp:10
ContainerType< ElementType > concatContainersCopy(ContainerType< ElementType > lhs, ContainerType< ElementType > const &rhs)
Definition concat_containers.hpp:23
void concatContainers(ContainerType< ElementType > &lhs, ContainerType< ElementType > const &rhs)
Definition concat_containers.hpp:8