summaryrefslogtreecommitdiffstats
path: root/Source/cm_memory.hxx
blob: 9f5e67827bd0f4aa3675a86f5514fa07d74aaeff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
#ifndef cm_memory_hxx
#define cm_memory_hxx

#include "cmConfigure.h" // IWYU pragma: keep

#include <memory> // IWYU pragma: export
#if !defined(CMake_HAVE_CXX_MAKE_UNIQUE)
#  include <utility>
#endif

namespace cm {

#if defined(CMake_HAVE_CXX_MAKE_UNIQUE)

using std::make_unique;

#else

template <typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args)
{
  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}

#endif

} // namespace cm

#endif