diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2020-02-24 18:09:49 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2020-02-24 18:09:49 +0100 |
commit | 1f4e2ab7462f5e05e452fb8505185895d91651c2 (patch) | |
tree | e36d1e08c41ddf2ebf5c8f27fc85b0250cda3e38 /apt-pkg/pkgcachegen.h | |
parent | c3587c0d9de852eca11d9bbc004095d54115eda4 (diff) |
Wrap AllocateInMap with a templated version
Diffstat (limited to 'apt-pkg/pkgcachegen.h')
-rw-r--r-- | apt-pkg/pkgcachegen.h | 5 |
1 files changed, 4 insertions, 1 deletions
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<void> AllocateInMap(const unsigned long &size); + APT_HIDDEN uint32_t AllocateInMap(const unsigned long &size); + template<typename T> map_pointer<T> AllocateInMap() { + return map_pointer<T>{AllocateInMap(sizeof(T))}; + } // Dirty hack for public users that do not use C++11 yet #if __cplusplus >= 201103L |