proxygen
ExpectingAlloc< T > Struct Template Reference

Public Types

using value_type = T
 

Public Member Functions

 ExpectingAlloc (std::size_t expectedSize, std::size_t expectedCount)
 
template<class U >
 ExpectingAlloc (ExpectingAlloc< U > const &other) noexcept
 
Tallocate (std::size_t n)
 
void deallocate (T *p, std::size_t n)
 

Public Attributes

std::size_t expectedSize_
 
std::size_t expectedCount_
 

Detailed Description

template<typename T>
struct ExpectingAlloc< T >

Definition at line 341 of file MemoryTest.cpp.

Member Typedef Documentation

template<typename T>
using ExpectingAlloc< T >::value_type = T

Definition at line 342 of file MemoryTest.cpp.

Constructor & Destructor Documentation

template<typename T>
ExpectingAlloc< T >::ExpectingAlloc ( std::size_t  expectedSize,
std::size_t  expectedCount 
)
inline

Definition at line 344 of file MemoryTest.cpp.

345  : expectedSize_{expectedSize}, expectedCount_{expectedCount} {}
std::size_t expectedCount_
Definition: MemoryTest.cpp:364
std::size_t expectedSize_
Definition: MemoryTest.cpp:363
template<typename T>
template<class U >
ExpectingAlloc< T >::ExpectingAlloc ( ExpectingAlloc< U > const &  other)
inlineexplicitnoexcept

Definition at line 348 of file MemoryTest.cpp.

349  : expectedSize_{other.expectedSize_},
std::size_t expectedCount_
Definition: MemoryTest.cpp:364
std::size_t expectedSize_
Definition: MemoryTest.cpp:363

Member Function Documentation

template<typename T>
T* ExpectingAlloc< T >::allocate ( std::size_t  n)
inline

Definition at line 352 of file MemoryTest.cpp.

References EXPECT_EQ, and folly::T.

352  {
353  EXPECT_EQ(expectedSize_, sizeof(T));
354  EXPECT_EQ(expectedSize_, alignof(T));
356  return std::allocator<T>{}.allocate(n);
357  }
#define T(v)
Definition: http_parser.c:233
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
std::size_t expectedCount_
Definition: MemoryTest.cpp:364
std::size_t expectedSize_
Definition: MemoryTest.cpp:363
template<typename T>
void ExpectingAlloc< T >::deallocate ( T p,
std::size_t  n 
)
inline

Definition at line 359 of file MemoryTest.cpp.

359  {
360  std::allocator<T>{}.deallocate(p, n);
361  }

Member Data Documentation

template<typename T>
std::size_t ExpectingAlloc< T >::expectedCount_

Definition at line 364 of file MemoryTest.cpp.

template<typename T>
std::size_t ExpectingAlloc< T >::expectedSize_

Definition at line 363 of file MemoryTest.cpp.


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