Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(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;
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict