proxygen
MmapAllocator< T > Class Template Reference

Classes

struct  rebind
 

Public Types

typedef T value_type
 
typedef Tpointer
 
typedef const Tconst_pointer
 
typedef Treference
 
typedef const Tconst_reference
 
typedef ptrdiff_t difference_type
 
typedef size_t size_type
 

Public Member Functions

Taddress (T &x) const
 
const Taddress (const T &x) const
 
size_t max_size () const
 
bool operator!= (const MmapAllocator< T > &other) const
 
bool operator== (const MmapAllocator< T > &) const
 
template<class... Args>
void construct (T *p, Args &&...args)
 
void destroy (T *p)
 
Tallocate (size_t n)
 
void deallocate (T *p, size_t n)
 

Detailed Description

template<class T>
class MmapAllocator< T >

Definition at line 33 of file AtomicHashArrayTest.cpp.

Member Typedef Documentation

template<class T>
typedef const T* MmapAllocator< T >::const_pointer

Definition at line 37 of file AtomicHashArrayTest.cpp.

template<class T>
typedef const T& MmapAllocator< T >::const_reference

Definition at line 39 of file AtomicHashArrayTest.cpp.

template<class T>
typedef ptrdiff_t MmapAllocator< T >::difference_type

Definition at line 41 of file AtomicHashArrayTest.cpp.

template<class T>
typedef T* MmapAllocator< T >::pointer

Definition at line 36 of file AtomicHashArrayTest.cpp.

template<class T>
typedef T& MmapAllocator< T >::reference

Definition at line 38 of file AtomicHashArrayTest.cpp.

template<class T>
typedef size_t MmapAllocator< T >::size_type

Definition at line 42 of file AtomicHashArrayTest.cpp.

template<class T>
typedef T MmapAllocator< T >::value_type

Definition at line 35 of file AtomicHashArrayTest.cpp.

Member Function Documentation

template<class T>
T* MmapAllocator< T >::address ( T x) const
inline

Definition at line 44 of file AtomicHashArrayTest.cpp.

44  {
45  return std::addressof(x);
46  }
Definition: InvokeTest.cpp:58
template<class T>
const T* MmapAllocator< T >::address ( const T x) const
inline

Definition at line 48 of file AtomicHashArrayTest.cpp.

48  {
49  return std::addressof(x);
50  }
Definition: InvokeTest.cpp:58
template<class T>
T* MmapAllocator< T >::allocate ( size_t  n)
inline

Definition at line 78 of file AtomicHashArrayTest.cpp.

References T.

78  {
79  void* p = mmap(
80  nullptr,
81  n * sizeof(T),
82  PROT_READ | PROT_WRITE,
83  MAP_PRIVATE | MAP_ANONYMOUS,
84  -1,
85  0);
86  if (p == MAP_FAILED) {
87  throw std::bad_alloc();
88  }
89  return (T*)p;
90  }
#define T(v)
Definition: http_parser.c:233
template<class T>
template<class... Args>
void MmapAllocator< T >::construct ( T p,
Args &&...  args 
)
inline

Definition at line 70 of file AtomicHashArrayTest.cpp.

References T.

70  {
71  new (p) T(std::forward<Args>(args)...);
72  }
#define T(v)
Definition: http_parser.c:233
template<class T>
void MmapAllocator< T >::deallocate ( T p,
size_t  n 
)
inline

Definition at line 92 of file AtomicHashArrayTest.cpp.

References T.

92  {
93  munmap(p, n * sizeof(T));
94  }
#define T(v)
Definition: http_parser.c:233
template<class T>
void MmapAllocator< T >::destroy ( T p)
inline

Definition at line 74 of file AtomicHashArrayTest.cpp.

74  {
75  p->~T();
76  }
template<class T>
size_t MmapAllocator< T >::max_size ( ) const
inline

Definition at line 52 of file AtomicHashArrayTest.cpp.

References max.

52  {
54  }
LogLevel max
Definition: LogLevel.cpp:31
template<class T>
bool MmapAllocator< T >::operator!= ( const MmapAllocator< T > &  other) const
inline

Definition at line 61 of file AtomicHashArrayTest.cpp.

61  {
62  return !(*this == other);
63  }
template<class T>
bool MmapAllocator< T >::operator== ( const MmapAllocator< T > &  ) const
inline

Definition at line 65 of file AtomicHashArrayTest.cpp.

References testing::Args().

65  {
66  return true;
67  }

The documentation for this class was generated from the following file: