From 1f4e2ab7462f5e05e452fb8505185895d91651c2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 24 Feb 2020 18:09:49 +0100 Subject: Wrap AllocateInMap with a templated version --- apt-pkg/pkgcachegen.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg/pkgcachegen.h') diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index d088bca52..c042625c4 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -40,7 +40,10 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/ APT_HIDDEN map_stringitem_t WriteStringInMap(APT::StringView String) { return WriteStringInMap(String.data(), String.size()); }; APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String); APT_HIDDEN map_stringitem_t WriteStringInMap(const char *String, const unsigned long &Len); - APT_HIDDEN map_pointer AllocateInMap(const unsigned long &size); + APT_HIDDEN uint32_t AllocateInMap(const unsigned long &size); + template map_pointer AllocateInMap() { + return map_pointer{AllocateInMap(sizeof(T))}; + } // Dirty hack for public users that do not use C++11 yet #if __cplusplus >= 201103L -- cgit v1.2.3