Dawn/src/dawn/util/array.hpp
2023-11-01 20:33:46 -05:00

46 lines
1.2 KiB
C++

// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnsharedlibs.hpp"
#include "assert/assert.hpp"
namespace Dawn {
/**
* Append a list on to another list.
*
* @param list Pointer to list that is being appended to.
* @param append Pointer to list that will be appended.
*/
template<typename T>
void vectorAppend(std::vector<T> *list, std::vector<T> *append) {
assertNotNull(list, "vectorAppend: list cannot be null");
assertNotNull(append, "vectorAppend: append cannot be null");
auto it = append->begin();
while(it != append->end()) {
list->push_back(*it);
++it;
}
}
/**
* Append a list on to another list.
*
* @param list Pointer to list that is being appended to.
* @param append List that will be appended.
*/
template<typename T>
void vectorAppend(std::vector<T> *list, std::vector<T> append) {
assertNotNull(list, "vectorAppend: list cannot be null");
auto it = append.begin();
while(it != append.end()) {
list->push_back(*it);
++it;
}
}
}