proxygen
folly::SysAllocator< T > Class Template Reference

#include <Memory.h>

Public Types

using value_type = T
 

Public Member Functions

Tallocate (size_t count)
 
void deallocate (T *p, size_t)
 

Private Types

using Self = SysAllocator< T >
 

Friends

bool operator== (Self const &, Self const &) noexcept
 
bool operator!= (Self const &, Self const &) noexcept
 

Detailed Description

template<typename T>
class folly::SysAllocator< T >

SysAllocator

Resembles std::allocator, the default Allocator, but wraps std::malloc and std::free.

Definition at line 368 of file Memory.h.

Member Typedef Documentation

template<typename T>
using folly::SysAllocator< T >::Self = SysAllocator<T>
private

Definition at line 370 of file Memory.h.

template<typename T>
using folly::SysAllocator< T >::value_type = T

Definition at line 373 of file Memory.h.

Member Function Documentation

template<typename T>
T* folly::SysAllocator< T >::allocate ( size_t  count)
inline

Definition at line 375 of file Memory.h.

References folly::T.

375  {
376  using lifted = typename detail::lift_void_to_char<T>::type;
377  auto const p = std::malloc(sizeof(lifted) * count);
378  if (!p) {
379  throw_exception<std::bad_alloc>();
380  }
381  return static_cast<T*>(p);
382  }
folly::std T
int * count
template<typename T>
void folly::SysAllocator< T >::deallocate ( T p,
size_t   
)
inline

Definition at line 383 of file Memory.h.

References bm::free().

383  {
384  std::free(p);
385  }
void free()

Friends And Related Function Documentation

template<typename T>
bool operator!= ( Self const &  ,
Self const &   
)
friend

Definition at line 390 of file Memory.h.

390  {
391  return false;
392  }
template<typename T>
bool operator== ( Self const &  ,
Self const &   
)
friend

Definition at line 387 of file Memory.h.

387  {
388  return true;
389  }

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