|
Fang-Robotics-MCB
Fang Robotics Team Codebase
|
Functions | |
| template<typename T , typename ... C> | |
| std::vector< T > | makeVectorWithMovedList (C ... movedElement) |
| std::vector< T > fang::stl::makeVectorWithMovedList | ( | C ... | movedElement | ) |
Takes an arbitrary amount of arguments and moves them into a vector and returns said vector.
Due to the shenanigans of vectors and initailizer lists, it is current impossible to initialize a vector of unique pointers since it copies all of its elements. Thus, we do this hack :D
THhs can work for anything that needs std::move()
This uses a feature called variadic templates.
Adapt from general printing to adding elements to a vector https://stackoverflow.com/questions/7230621/how-can-i-iterate-over-a-packed-variadic-template-argument-list#60136761
T and all instances of C should be the same class