cm_memory.hxx 631 B

12345678910111213141516171819202122232425262728293031
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cm_memory_hxx
  4. #define cm_memory_hxx
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <memory> // IWYU pragma: export
  7. #if !defined(CMake_HAVE_CXX_MAKE_UNIQUE)
  8. # include <utility>
  9. #endif
  10. namespace cm {
  11. #if defined(CMake_HAVE_CXX_MAKE_UNIQUE)
  12. using std::make_unique;
  13. #else
  14. template <typename T, typename... Args>
  15. std::unique_ptr<T> make_unique(Args&&... args)
  16. {
  17. return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
  18. }
  19. #endif
  20. } // namespace cm
  21. #endif