proxygen
folly::f14::GenericAlloc< T > Class Template Reference

#include <F14TestUtil.h>

Public Types

using value_type = T
 
using pointer = T *
 
using const_pointer = T const *
 
using reference = T &
 
using const_reference = T const &
 
using size_type = std::size_t
 
using propagate_on_container_swap = std::true_type
 
using propagate_on_container_copy_assignment = std::true_type
 
using propagate_on_container_move_assignment = std::true_type
 
using AllocBytesFunc = folly::Function< void *(std::size_t)>
 
using DeallocBytesFunc = folly::Function< void(void *, std::size_t)>
 

Public Member Functions

 GenericAlloc ()=delete
 
template<typename A , typename D >
 GenericAlloc (A &&alloc, D &&dealloc)
 
template<class U >
 GenericAlloc (GenericAlloc< U > const &other) noexcept
 
template<class U >
GenericAllocoperator= (GenericAlloc< U > const &other) noexcept
 
template<class U >
 GenericAlloc (GenericAlloc< U > &&other) noexcept
 
template<class U >
GenericAllocoperator= (GenericAlloc< U > &&other) noexcept
 
Tallocate (size_t n)
 
void deallocate (T *p, size_t n)
 
template<typename U >
bool operator== (GenericAlloc< U > const &rhs) const
 
template<typename U >
bool operator!= (GenericAlloc< U > const &rhs) const
 

Private Attributes

std::shared_ptr< AllocBytesFuncalloc_
 
std::shared_ptr< DeallocBytesFuncdealloc_
 

Friends

template<class U >
class GenericAlloc
 

Detailed Description

template<class T>
class folly::f14::GenericAlloc< T >

Definition at line 470 of file F14TestUtil.h.

Member Typedef Documentation

template<class T>
using folly::f14::GenericAlloc< T >::AllocBytesFunc = folly::Function<void*(std::size_t)>

Definition at line 484 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::const_pointer = T const*

Definition at line 475 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::const_reference = T const&

Definition at line 477 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::DeallocBytesFunc = folly::Function<void(void*, std::size_t)>

Definition at line 485 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::pointer = T*

Definition at line 474 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::propagate_on_container_copy_assignment = std::true_type

Definition at line 481 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::propagate_on_container_move_assignment = std::true_type

Definition at line 482 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::propagate_on_container_swap = std::true_type

Definition at line 480 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::reference = T&

Definition at line 476 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::size_type = std::size_t

Definition at line 478 of file F14TestUtil.h.

template<class T>
using folly::f14::GenericAlloc< T >::value_type = T

Definition at line 472 of file F14TestUtil.h.

Constructor & Destructor Documentation

template<class T>
folly::f14::GenericAlloc< T >::GenericAlloc ( )
delete
template<class T>
template<typename A , typename D >
folly::f14::GenericAlloc< T >::GenericAlloc ( A &&  alloc,
D &&  dealloc 
)
inline

Definition at line 490 of file F14TestUtil.h.

491  : alloc_{std::make_shared<AllocBytesFunc>(std::forward<A>(alloc))},
492  dealloc_{std::make_shared<DeallocBytesFunc>(std::forward<D>(dealloc))} {
493  }
std::shared_ptr< DeallocBytesFunc > dealloc_
Definition: F14TestUtil.h:536
std::shared_ptr< AllocBytesFunc > alloc_
Definition: F14TestUtil.h:535
template<class T>
template<class U >
folly::f14::GenericAlloc< T >::GenericAlloc ( GenericAlloc< U > const &  other)
inlinenoexcept

Definition at line 496 of file F14TestUtil.h.

497  : alloc_{other.alloc_}, dealloc_{other.dealloc_} {}
std::shared_ptr< DeallocBytesFunc > dealloc_
Definition: F14TestUtil.h:536
std::shared_ptr< AllocBytesFunc > alloc_
Definition: F14TestUtil.h:535
template<class T>
template<class U >
folly::f14::GenericAlloc< T >::GenericAlloc ( GenericAlloc< U > &&  other)
inlinenoexcept

Definition at line 507 of file F14TestUtil.h.

508  : alloc_(std::move(other.alloc_)), dealloc_(std::move(other.dealloc_)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::shared_ptr< DeallocBytesFunc > dealloc_
Definition: F14TestUtil.h:536
std::shared_ptr< AllocBytesFunc > alloc_
Definition: F14TestUtil.h:535

Member Function Documentation

template<class T>
T* folly::f14::GenericAlloc< T >::allocate ( size_t  n)
inline

Definition at line 517 of file F14TestUtil.h.

References folly::T.

517  {
518  return static_cast<T*>((*alloc_)(n * sizeof(T)));
519  }
folly::std T
template<class T>
void folly::f14::GenericAlloc< T >::deallocate ( T p,
size_t  n 
)
inline

Definition at line 520 of file F14TestUtil.h.

References folly::T.

520  {
521  (*dealloc_)(static_cast<void*>(p), n * sizeof(T));
522  }
folly::std T
template<class T>
template<typename U >
bool folly::f14::GenericAlloc< T >::operator!= ( GenericAlloc< U > const &  rhs) const
inline

Definition at line 530 of file F14TestUtil.h.

References folly::detail::rhs.

530  {
531  return !(*this == rhs);
532  }
FOLLY_PUSH_WARNING RHS rhs
Definition: Traits.h:649
template<class T>
template<class U >
GenericAlloc& folly::f14::GenericAlloc< T >::operator= ( GenericAlloc< U > const &  other)
inlinenoexcept

Definition at line 500 of file F14TestUtil.h.

500  {
501  alloc_ = other.alloc_;
502  dealloc_ = other.dealloc_;
503  return *this;
504  }
std::shared_ptr< DeallocBytesFunc > dealloc_
Definition: F14TestUtil.h:536
std::shared_ptr< AllocBytesFunc > alloc_
Definition: F14TestUtil.h:535
template<class T>
template<class U >
GenericAlloc& folly::f14::GenericAlloc< T >::operator= ( GenericAlloc< U > &&  other)
inlinenoexcept

Definition at line 511 of file F14TestUtil.h.

References folly::gen::move.

511  {
512  alloc_ = std::move(other.alloc_);
513  dealloc_ = std::move(other.dealloc_);
514  return *this;
515  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::shared_ptr< DeallocBytesFunc > dealloc_
Definition: F14TestUtil.h:536
std::shared_ptr< AllocBytesFunc > alloc_
Definition: F14TestUtil.h:535
template<class T>
template<typename U >
bool folly::f14::GenericAlloc< T >::operator== ( GenericAlloc< U > const &  rhs) const
inline

Definition at line 525 of file F14TestUtil.h.

References folly::f14::GenericAlloc< T >::alloc_.

525  {
526  return alloc_ == rhs.alloc_;
527  }
FOLLY_PUSH_WARNING RHS rhs
Definition: Traits.h:649
std::shared_ptr< AllocBytesFunc > alloc_
Definition: F14TestUtil.h:535

Friends And Related Function Documentation

template<class T>
template<class U >
friend class GenericAlloc
friend

Definition at line 539 of file F14TestUtil.h.

Member Data Documentation

template<class T>
std::shared_ptr<AllocBytesFunc> folly::f14::GenericAlloc< T >::alloc_
private

Definition at line 535 of file F14TestUtil.h.

Referenced by folly::f14::GenericAlloc< T >::operator==().

template<class T>
std::shared_ptr<DeallocBytesFunc> folly::f14::GenericAlloc< T >::dealloc_
private

Definition at line 536 of file F14TestUtil.h.


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