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

#include <F14TestUtil.h>

Public Types

using Alloc = std::allocator< T >
 
using value_type = typename Alloc::value_type
 
using pointer = typename Alloc::pointer
 
using const_pointer = typename Alloc::const_pointer
 
using reference = typename Alloc::reference
 
using const_reference = typename Alloc::const_reference
 
using size_type = typename Alloc::size_type
 
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
 

Public Member Functions

 SwapTrackingAlloc ()
 
template<class U >
 SwapTrackingAlloc (SwapTrackingAlloc< U > const &other) noexcept
 
template<class U >
SwapTrackingAllocoperator= (SwapTrackingAlloc< U > const &other) noexcept
 
template<class U >
 SwapTrackingAlloc (SwapTrackingAlloc< U > &&other) noexcept
 
template<class U >
SwapTrackingAllocoperator= (SwapTrackingAlloc< U > &&other) noexcept
 
Tallocate (size_t n)
 
void deallocate (T *p, size_t n)
 

Private Attributes

std::allocator< Ta_
 
folly::f14::Tracked< 0 > t_
 

Friends

template<class U >
class SwapTrackingAlloc
 

Detailed Description

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

Definition at line 351 of file F14TestUtil.h.

Member Typedef Documentation

template<class T>
using folly::f14::SwapTrackingAlloc< T >::Alloc = std::allocator<T>

Definition at line 353 of file F14TestUtil.h.

template<class T>
using folly::f14::SwapTrackingAlloc< T >::const_pointer = typename Alloc::const_pointer

Definition at line 357 of file F14TestUtil.h.

template<class T>
using folly::f14::SwapTrackingAlloc< T >::const_reference = typename Alloc::const_reference

Definition at line 359 of file F14TestUtil.h.

template<class T>
using folly::f14::SwapTrackingAlloc< T >::pointer = typename Alloc::pointer

Definition at line 356 of file F14TestUtil.h.

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

Definition at line 363 of file F14TestUtil.h.

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

Definition at line 364 of file F14TestUtil.h.

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

Definition at line 362 of file F14TestUtil.h.

template<class T>
using folly::f14::SwapTrackingAlloc< T >::reference = typename Alloc::reference

Definition at line 358 of file F14TestUtil.h.

template<class T>
using folly::f14::SwapTrackingAlloc< T >::size_type = typename Alloc::size_type

Definition at line 360 of file F14TestUtil.h.

template<class T>
using folly::f14::SwapTrackingAlloc< T >::value_type = typename Alloc::value_type

Definition at line 354 of file F14TestUtil.h.

Constructor & Destructor Documentation

template<class T>
folly::f14::SwapTrackingAlloc< T >::SwapTrackingAlloc ( )
inline

Definition at line 366 of file F14TestUtil.h.

366 {}
template<class T>
template<class U >
folly::f14::SwapTrackingAlloc< T >::SwapTrackingAlloc ( SwapTrackingAlloc< U > const &  other)
inlinenoexcept

Definition at line 369 of file F14TestUtil.h.

370  : a_(other.a_), t_(other.t_) {}
folly::f14::Tracked< 0 > t_
Definition: F14TestUtil.h:407
std::allocator< T > a_
Definition: F14TestUtil.h:406
template<class T>
template<class U >
folly::f14::SwapTrackingAlloc< T >::SwapTrackingAlloc ( SwapTrackingAlloc< U > &&  other)
inlinenoexcept

Definition at line 380 of file F14TestUtil.h.

381  : a_(std::move(other.a_)), t_(std::move(other.t_)) {}
folly::f14::Tracked< 0 > t_
Definition: F14TestUtil.h:407
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::allocator< T > a_
Definition: F14TestUtil.h:406

Member Function Documentation

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

Definition at line 390 of file F14TestUtil.h.

References folly::T, folly::f14::testAllocatedBlockCount, folly::f14::testAllocatedMemorySize, folly::f14::testAllocationCount, and folly::f14::testAllocationMaxCount.

390  {
392  throw std::bad_alloc();
393  }
395  testAllocatedMemorySize += n * sizeof(T);
397  return a_.allocate(n);
398  }
thread_local size_t testAllocationCount
Definition: F14TestUtil.h:324
folly::std T
thread_local size_t testAllocatedBlockCount
Definition: F14TestUtil.h:323
thread_local size_t testAllocatedMemorySize
Definition: F14TestUtil.h:322
std::allocator< T > a_
Definition: F14TestUtil.h:406
thread_local size_t testAllocationMaxCount
Definition: F14TestUtil.h:325
template<class T>
void folly::f14::SwapTrackingAlloc< T >::deallocate ( T p,
size_t  n 
)
inline

Definition at line 399 of file F14TestUtil.h.

References folly::T, folly::f14::testAllocatedBlockCount, and folly::f14::testAllocatedMemorySize.

399  {
400  testAllocatedMemorySize -= n * sizeof(T);
402  a_.deallocate(p, n);
403  }
folly::std T
thread_local size_t testAllocatedBlockCount
Definition: F14TestUtil.h:323
thread_local size_t testAllocatedMemorySize
Definition: F14TestUtil.h:322
std::allocator< T > a_
Definition: F14TestUtil.h:406
template<class T>
template<class U >
SwapTrackingAlloc& folly::f14::SwapTrackingAlloc< T >::operator= ( SwapTrackingAlloc< U > const &  other)
inlinenoexcept

Definition at line 373 of file F14TestUtil.h.

373  {
374  a_ = other.a_;
375  t_ = other.t_;
376  return *this;
377  }
folly::f14::Tracked< 0 > t_
Definition: F14TestUtil.h:407
std::allocator< T > a_
Definition: F14TestUtil.h:406
template<class T>
template<class U >
SwapTrackingAlloc& folly::f14::SwapTrackingAlloc< T >::operator= ( SwapTrackingAlloc< U > &&  other)
inlinenoexcept

Definition at line 384 of file F14TestUtil.h.

References folly::gen::move.

384  {
385  a_ = std::move(other.a_);
386  t_ = std::move(other.t_);
387  return *this;
388  }
folly::f14::Tracked< 0 > t_
Definition: F14TestUtil.h:407
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::allocator< T > a_
Definition: F14TestUtil.h:406

Friends And Related Function Documentation

template<class T>
template<class U >
friend class SwapTrackingAlloc
friend

Definition at line 410 of file F14TestUtil.h.

Member Data Documentation

template<class T>
std::allocator<T> folly::f14::SwapTrackingAlloc< T >::a_
private

Definition at line 406 of file F14TestUtil.h.

template<class T>
folly::f14::Tracked<0> folly::f14::SwapTrackingAlloc< T >::t_
private

Definition at line 407 of file F14TestUtil.h.


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