PoolingAllocator.h
Go to the documentation of this file.
1 /*
2 + * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
3 + *
4 + * Squid software is distributed under GPLv2+ license and includes
5 + * contributions from numerous individuals and organizations.
6 + * Please see the COPYING and CONTRIBUTORS files for details.
7 + */
8 
9 #ifndef SQUID_MEM_POOLINGALLOCATOR_H
10 #define SQUID_MEM_POOLINGALLOCATOR_H
11 
12 #include "mem/forward.h"
13 
15 template <class Value>
17 {
18 public:
19  /* STL Allocator API */
20  using value_type = Value;
21  PoolingAllocator() noexcept {}
22  template <class Other> PoolingAllocator(const PoolingAllocator<Other> &) noexcept {}
23  value_type *allocate(std::size_t n) { return static_cast<value_type*>(memAllocRigid(n*sizeof(value_type))); }
24  void deallocate(value_type *vp, std::size_t n) noexcept { memFreeRigid(vp, n*sizeof(value_type)); }
25 };
26 
27 template <class L, class R>
28 inline bool
30 {
31  return true;
32 }
33 
34 template <class L, class R>
35 inline bool
37 {
38  return !(l == r);
39 }
40 
41 #endif /* SQUID_MEM_POOLINGALLOCATOR_H */
42 
void deallocate(value_type *vp, std::size_t n) noexcept
void * memAllocRigid(size_t net_size)
Definition: old_api.cc:249
PoolingAllocator(const PoolingAllocator< Other > &) noexcept
void memFreeRigid(void *, size_t net_size)
Definition: old_api.cc:291
bool operator!=(const PoolingAllocator< L > &l, const PoolingAllocator< R > &r) noexcept
value_type * allocate(std::size_t n)
int const char size_t
Definition: stub_liblog.cc:86
STL Allocator that uses Squid memory pools for memory management.
PoolingAllocator() noexcept
bool operator==(const PoolingAllocator< L > &, const PoolingAllocator< R > &) noexcept

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors