(C++) CreateVector

January 7, 2018 · View on GitHub

 

 

 

 

 

(C++) CreateVector

 

CreateVector is a std::vector code snippet to create a std::vector from three values.

 


//From http://www.richelbilderbeek.nl/CppCreateVector.htm template <class T> const std::vector<T> CreateVector(const T& a, const T& b, const T& c) {   std::vector<T> v;   v.reserve(3);   v.push_back(a);   v.push_back(b);   v.push_back(c);   return v; }