proxygen
folly::CxxAllocatorAdaptor< T, Inner > Class Template Reference

#include <Memory.h>

Public Types

using value_type = T
 
using propagate_on_container_copy_assignment = std::true_type
 
using propagate_on_container_move_assignment = std::true_type
 
using propagate_on_container_swap = std::true_type
 

Public Member Functions

 CxxAllocatorAdaptor (Inner &ref)
 
template<typename U >
 CxxAllocatorAdaptor (CxxAllocatorAdaptor< U, Inner > const &other)
 
Tallocate (std::size_t n)
 
void deallocate (T *p, std::size_t n)
 

Private Types

using Self = CxxAllocatorAdaptor< T, Inner >
 

Private Attributes

std::reference_wrapper< Inner > ref_
 

Friends

template<typename U , typename UAlloc >
class CxxAllocatorAdaptor
 
bool operator== (Self const &a, Self const &b) noexcept
 
bool operator!= (Self const &a, Self const &b) noexcept
 

Detailed Description

template<typename T, class Inner>
class folly::CxxAllocatorAdaptor< T, Inner >

CxxAllocatorAdaptor

A type conforming to C++ concept Allocator, delegating operations to an unowned Inner which has this required interface:

void* allocate(std::size_t) void deallocate(void*, std::size_t)

Note that Inner is not a C++ Allocator.

Definition at line 522 of file Memory.h.

Member Typedef Documentation

template<typename T, class Inner>
using folly::CxxAllocatorAdaptor< T, Inner >::propagate_on_container_copy_assignment = std::true_type

Definition at line 534 of file Memory.h.

template<typename T, class Inner>
using folly::CxxAllocatorAdaptor< T, Inner >::propagate_on_container_move_assignment = std::true_type

Definition at line 535 of file Memory.h.

template<typename T, class Inner>
using folly::CxxAllocatorAdaptor< T, Inner >::propagate_on_container_swap = std::true_type

Definition at line 536 of file Memory.h.

template<typename T, class Inner>
using folly::CxxAllocatorAdaptor< T, Inner >::Self = CxxAllocatorAdaptor<T, Inner>
private

Definition at line 524 of file Memory.h.

template<typename T, class Inner>
using folly::CxxAllocatorAdaptor< T, Inner >::value_type = T

Definition at line 532 of file Memory.h.

Constructor & Destructor Documentation

template<typename T, class Inner>
folly::CxxAllocatorAdaptor< T, Inner >::CxxAllocatorAdaptor ( Inner &  ref)
inlineexplicit

Definition at line 538 of file Memory.h.

538 : ref_(ref) {}
std::reference_wrapper< Inner > ref_
Definition: Memory.h:529
template<typename T, class Inner>
template<typename U >
folly::CxxAllocatorAdaptor< T, Inner >::CxxAllocatorAdaptor ( CxxAllocatorAdaptor< U, Inner > const &  other)
inlineexplicit

Definition at line 541 of file Memory.h.

542  : ref_(other.ref_) {}
std::reference_wrapper< Inner > ref_
Definition: Memory.h:529

Member Function Documentation

template<typename T, class Inner>
T* folly::CxxAllocatorAdaptor< T, Inner >::allocate ( std::size_t  n)
inline

Definition at line 544 of file Memory.h.

References folly::T.

544  {
545  using lifted = typename detail::lift_void_to_char<T>::type;
546  return static_cast<T*>(ref_.get().allocate(sizeof(lifted) * n));
547  }
folly::std T
std::reference_wrapper< Inner > ref_
Definition: Memory.h:529
template<typename T, class Inner>
void folly::CxxAllocatorAdaptor< T, Inner >::deallocate ( T p,
std::size_t  n 
)
inline

Definition at line 548 of file Memory.h.

548  {
549  using lifted = typename detail::lift_void_to_char<T>::type;
550  ref_.get().deallocate(p, sizeof(lifted) * n);
551  }
std::reference_wrapper< Inner > ref_
Definition: Memory.h:529

Friends And Related Function Documentation

template<typename T, class Inner>
template<typename U , typename UAlloc >
friend class CxxAllocatorAdaptor
friend

Definition at line 527 of file Memory.h.

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

Definition at line 556 of file Memory.h.

556  {
557  return std::addressof(a.ref_.get()) != std::addressof(b.ref_.get());
558  }
char b
char a
template<typename T, class Inner>
bool operator== ( Self const &  a,
Self const &  b 
)
friend

Definition at line 553 of file Memory.h.

553  {
554  return std::addressof(a.ref_.get()) == std::addressof(b.ref_.get());
555  }
char b
char a

Member Data Documentation

template<typename T, class Inner>
std::reference_wrapper<Inner> folly::CxxAllocatorAdaptor< T, Inner >::ref_
private

Definition at line 529 of file Memory.h.


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