X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fmake-unique-wrapper.hpp;h=282181cffa58439b9dd7642949a40701c3b67512;hb=303ac4ed4037e45da1976c0951358ec19c5364d0;hp=50d1916f20239624525c5226a926f5e76f58e3af;hpb=8802d23ba9c07d32d0da22213d8e76ed102d553f;p=lttng-tools.git diff --git a/src/common/make-unique-wrapper.hpp b/src/common/make-unique-wrapper.hpp index 50d1916f2..282181cff 100644 --- a/src/common/make-unique-wrapper.hpp +++ b/src/common/make-unique-wrapper.hpp @@ -38,10 +38,9 @@ namespace lttng { * a proper, idiomatic, wrapper. */ -namespace details -{ +namespace memory { template -struct create_unique_class { +struct create_deleter_class { struct deleter { void operator()(WrappedType *instance) const { @@ -54,7 +53,6 @@ struct create_unique_class { return std::unique_ptr(instance); } }; -} /* namespace details */ /* * 'free' is a utility function for use with make_unique_wrapper. It makes it easier to @@ -67,12 +65,14 @@ void free(Type *ptr) { std::free(ptr); } +} /* namespace memory */ template -std::unique_ptr::deleter> -make_unique_wrapper(WrappedType *instance) +std::unique_ptr::deleter> +make_unique_wrapper(WrappedType *instance = nullptr) { - const details::create_unique_class unique_deleter; + const memory::create_deleter_class unique_deleter; return unique_deleter(instance); }