diff options
Diffstat (limited to 'Source/cmAlgorithms.h')
-rw-r--r-- | Source/cmAlgorithms.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 4adfe23..a4f66a9 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -9,6 +9,7 @@ #include <algorithm> #include <functional> #include <iterator> +#include <memory> #include <sstream> #include <string.h> #include <string> @@ -402,4 +403,22 @@ inline void cmStripSuffixIfExists(std::string& str, const std::string& suffix) } } +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 |