summaryrefslogtreecommitdiffstats
path: root/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-08 06:49:01 +0100
committerDavid Robillard <d@drobilla.net>2019-03-08 09:08:16 +0100
commite4edf13d6ed0a3bc8cb6103d48b082e850949e4c (patch)
treede3764ab52675777c5af602a3942d9afae9b11cb /ingen
parentce3f3aff9c27f902c6b6b5a0f8d9bdc3dfb26c3f (diff)
downloadingen-e4edf13d6ed0a3bc8cb6103d48b082e850949e4c.tar.gz
ingen-e4edf13d6ed0a3bc8cb6103d48b082e850949e4c.tar.bz2
ingen-e4edf13d6ed0a3bc8cb6103d48b082e850949e4c.zip
Add make_shared and make_unique utilities
Diffstat (limited to 'ingen')
-rw-r--r--ingen/types.hpp14
1 files changed, 14 insertions, 0 deletions
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<T> const_ptr_cast(const SPtr<U>& r) {
return std::const_pointer_cast<T>(r);
}
+template <typename T, typename... Args>
+std::unique_ptr<T>
+make_unique(Args&&... args)
+{
+ return std::unique_ptr<T>{new T{std::forward<Args>(args)...}};
+}
+
+template <typename T, typename... Args>
+std::shared_ptr<T>
+make_shared(Args&&... args)
+{
+ return std::make_shared<T>(std::forward<Args>(args)...);
+}
+
} // namespace ingen
#endif // INGEN_TYPES_HPP