common: Add a default nullptr argument to make_unique_wrapper
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 4 Feb 2023 00:24:54 +0000 (19:24 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 15 Jun 2023 15:50:28 +0000 (11:50 -0400)
commit799462ffd674d972289608c72b3f271a5839677a
tree4fb320c6786926a80a4c5b8396d1f9a7c20adaa6
parent0d1c8a685e82b1b358aa76796eb73cc79ad37fd8
common: Add a default nullptr argument to make_unique_wrapper

When wrapping C libraries that return unmanaged pointers,
lttng::make_unique_wrapper makes it easier to locally "wrap" returned
pointers.

  auto val = lttng::make_unique_ptr<struct foo *,
                                    lttng::free>(some_func());

However, in its current form, a nullptr must be passed to define an
alias:

  using my_type_uptr =
    decltype(lttng::make_unique_wrapper<lttng_session,
                                        lttng::free>(nullptr));

Adding a default nullptr argument cuts down a bit of boiler plate.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9d05d8162d28cc156b1e9ec6fe623f1cc02e9c8e
src/common/make-unique-wrapper.hpp
This page took 0.025158 seconds and 4 git commands to generate.