Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
fang::stl Namespace Reference

Functions

template<typename T , typename ... C>
std::vector< T > makeVectorWithMovedList (C ... movedElement)
 

Function Documentation

◆ makeVectorWithMovedList()

template<typename T , typename ... C>
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