blob: 8c221c82da04d06c0c1a2313b5a684208c5b7dbc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#ifndef CHUNKED_MEMORY_POOL_ALLOCATOR_INL_H_
#error "Direct inclusion of this file is not allowed, include chunked_memory_pool_allocator.h"
// For the sake of sane code completion.
#include "chunked_memory_pool_allocator.h"
#endif
#include <util/system/align.h>
namespace NYT {
////////////////////////////////////////////////////////////////////////////////
template <class T>
TChunkedMemoryPoolAllocator<T> TChunkedMemoryPoolAllocator<T>::select_on_container_copy_construction(
const TChunkedMemoryPoolAllocator& allocator) noexcept
{
return allocator;
}
template <class T>
TChunkedMemoryPoolAllocator<T>::TChunkedMemoryPoolAllocator(
TChunkedMemoryPool* pool) noexcept
: Pool_(pool)
{ }
template <class T>
template <class U>
TChunkedMemoryPoolAllocator<T>::TChunkedMemoryPoolAllocator(
const TChunkedMemoryPoolAllocator<U>& other) noexcept
: Pool_(other.Pool_)
{ }
template <class T>
T* TChunkedMemoryPoolAllocator<T>::allocate(std::size_t count)
{
return reinterpret_cast<T*>(Pool_->AllocateAligned(count * sizeof(T), alignof(T)));
}
template <class T>
void TChunkedMemoryPoolAllocator<T>::deallocate(
T* /*pointer*/,
std::size_t /*count*/) const noexcept
{ }
template <class T>
bool TChunkedMemoryPoolAllocator<T>::operator==(
const TChunkedMemoryPoolAllocator& other) const noexcept
{
return Pool_ == other.Pool_;
}
template <class T>
bool TChunkedMemoryPoolAllocator<T>::operator!=(
const TChunkedMemoryPoolAllocator& other) const noexcept
{
return !(*this == other);
}
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
|