I'm pretty sure I missed cases and introduced bugs with the new CGenerator triplit system, but I finally got all normal tests passing, and it's almost 5 in the morning, so I'm calling it a night. We have destructors and copy constructors now\! I need to work out copy assignment, but again, another day
This commit is contained in:
@@ -31,6 +31,21 @@ bool contains(std::vector<T> vec, T item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::vector<T> flatten(std::vector<std::vector<T>> vec) {
|
||||
std::vector<T> flat;
|
||||
for (auto i : vec)
|
||||
flat.insert(flat.end(), i.begin(), i.end());
|
||||
return flat;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::vector<T> reverse(std::vector<T> vec) {
|
||||
std::vector<T> flat;
|
||||
flat.insert(flat.end(), vec.rbegin(), vec.rend());
|
||||
return flat;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::vector<T> slice(std::vector<T> vec, int begin, int end, int step = 1) {
|
||||
std::vector<T> toReturn;
|
||||
|
||||
Reference in New Issue
Block a user