Program Listing for File Generics.h

Return to documentation for file (/tmp/ws/src/sick_safetyscanners_base/include/sick_safetyscanners_base/Generics.h)

// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-

// -- BEGIN LICENSE BLOCK ----------------------------------------------

// -- END LICENSE BLOCK ------------------------------------------------

//----------------------------------------------------------------------
//----------------------------------------------------------------------

#ifndef SICK_SAFETYSCANNERS_BASE_GENERICS_H
#define SICK_SAFETYSCANNERS_BASE_GENERICS_H

#include <memory>

namespace sick {

template <typename T, typename... Ts>
std::unique_ptr<T> make_unique(Ts&&... params)
{
  // C++11 does not come with a make_unique function, so here it is.
  // Borrowed from Scott Meyers' Effective C++ page 139.
  return std::unique_ptr<T>(new T(std::forward<Ts>(params)...));
}

} // namespace sick
#endif // SICK_SAFETYSCANNERS_BASE_GENERICS_H