Squashed commit of the following:
commit
fc8fe9813154aff1cfa2891d1803681012a3f337
Author: Michael Altizer <mialtize@cisco.com>
Date: Fri Apr 3 12:16:19 2020 -0400
host_tracker: Move all HostCacheAlloc template implementions to the header
#include "host_cache.h"
-template <class T>
-T* HostCacheAlloc<T>::allocate(std::size_t n)
-{
- size_t sz=n*sizeof(T);
- T* out=std::allocator<T>::allocate(n);
- lru->update(sz);
- return out;
-}
-
-template <class T>
-void HostCacheAlloc<T>::deallocate(T* p, std::size_t n) noexcept
-{
- size_t sz = n*sizeof(T);
- std::allocator<T>::deallocate(p, n);
- lru->update( -(int) sz);
-}
-
template <class T>
HostCacheAllocIp<T>::HostCacheAllocIp()
{
HostCacheInterface* lru = 0;
};
+template <class T>
+T* HostCacheAlloc<T>::allocate(std::size_t n)
+{
+ size_t sz = n * sizeof(T);
+ T* out = std::allocator<T>::allocate(n);
+ lru->update(sz);
+ return out;
+}
+
+template <class T>
+void HostCacheAlloc<T>::deallocate(T* p, std::size_t n) noexcept
+{
+ size_t sz = n * sizeof(T);
+ std::allocator<T>::deallocate(p, n);
+ lru->update(-(int) sz);
+}
+
// Trivial derived allocator, pointing to their own host cache.
// HostCacheAllocIp has a HostCacheInterface* pointing to an lru cache
lru = &host_cache;
}
-template <class T>
-void HostCacheAlloc<T>::deallocate(T* p, std::size_t n) noexcept
-{
- size_t sz = n*sizeof(T);
- std::allocator<T>::deallocate(p, n);
- lru->update( -(int) sz);
-}
-
TEST_GROUP(host_cache_module)
{
void setup() override