diff options
Diffstat (limited to 'include/qpdf/QUtil.hh')
-rw-r--r-- | include/qpdf/QUtil.hh | 9 |
1 files changed, 9 insertions, 0 deletions
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<char[]> make_unique_cstr(std::string const&); + // Create a shared pointer to an array. From c++20, + // std::make_shared<T[]>(n) does this. + template <typename T> + std::shared_ptr<T> + make_shared_array(size_t n) + { + return std::shared_ptr<T>(new T[n], std::default_delete<T[]>()); + } + // 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. |