]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add std::make_unique implementation
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 26 Sep 2019 17:53:41 +0000 (19:53 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Oct 2019 21:16:46 +0000 (23:16 +0200)
src/StdMakeUnique.hpp [new file with mode: 0644]

diff --git a/src/StdMakeUnique.hpp b/src/StdMakeUnique.hpp
new file mode 100644 (file)
index 0000000..829d2d5
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright (C) 2019 Joel Rosdahl and other contributors
+//
+// See doc/AUTHORS.adoc for a complete list of contributors.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3 of the License, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along with
+// this program; if not, write to the Free Software Foundation, Inc., 51
+// Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+#pragma once
+
+namespace std {
+
+#if __cplusplus < 201402L
+template<typename T, typename... TArgs>
+inline unique_ptr<T>
+make_unique(TArgs&&... args)
+{
+  return unique_ptr<T>(new T(std::forward<TArgs>(args)...));
+}
+#endif
+
+} // namespace std