From df2f5c6a360bd7512d2280aa9cb582bc0aa622bd Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 7 Feb 2022 08:02:16 -0500 Subject: Add QUtil::make_shared_array to help with PointerHolder transition --- include/qpdf/QUtil.hh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index 927fc1d8..b4cb1f6a 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -165,6 +165,15 @@ namespace QUtil QPDF_DLL std::unique_ptr make_unique_cstr(std::string const&); + // Create a shared pointer to an array. From c++20, + // std::make_shared(n) does this. + template + std::shared_ptr + make_shared_array(size_t n) + { + return std::shared_ptr(new T[n], std::default_delete()); + } + // Returns lower-case hex-encoded version of the string, treating // each character in the input string as unsigned. The output // string will be twice as long as the input string. -- cgit v1.2.3-54-g00ecf