memory 610 B

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