From e4edf13d6ed0a3bc8cb6103d48b082e850949e4c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 8 Mar 2019 06:49:01 +0100 Subject: Add make_shared and make_unique utilities --- ingen/types.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ingen/types.hpp b/ingen/types.hpp index 5e0d7506..98f700f5 100644 --- a/ingen/types.hpp +++ b/ingen/types.hpp @@ -57,6 +57,20 @@ SPtr const_ptr_cast(const SPtr& r) { return std::const_pointer_cast(r); } +template +std::unique_ptr +make_unique(Args&&... args) +{ + return std::unique_ptr{new T{std::forward(args)...}}; +} + +template +std::shared_ptr +make_shared(Args&&... args) +{ + return std::make_shared(std::forward(args)...); +} + } // namespace ingen #endif // INGEN_TYPES_HPP -- cgit v1.2.1