MCPcopy Create free account
hub / github.com/bloomberg/quantum / StackAllocator

Class StackAllocator

quantum/quantum_stack_allocator.h:34–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32/// @note This allocator is thread safe. For internal use only.
33template <typename T, unsigned int SIZE>
34struct StackAllocator : public ContiguousPoolManager<T>
35{
36 //------------------------------ Typedefs ----------------------------------
37 typedef StackAllocator<T, SIZE> this_type;
38 typedef T value_type;
39 typedef value_type* pointer;
40 typedef const value_type* const_pointer;
41 typedef value_type& reference;
42 typedef const value_type& const_reference;
43 typedef size_t size_type;
44 typedef uint16_t index_type;
45 typedef std::ptrdiff_t difference_type;
46 typedef std::false_type propagate_on_container_move_assignment;
47 typedef std::false_type propagate_on_container_copy_assignment;
48 typedef std::false_type propagate_on_container_swap;
49 typedef std::false_type is_always_equal;
50 typedef std::true_type default_constructor;
51 typedef std::aligned_storage<sizeof(value_type),
52 alignof(value_type)> storage_type;
53 typedef typename storage_type::type aligned_type;
54
55 template <typename U>
56 struct rebind
57 {
58 typedef StackAllocator<U,SIZE> other;
59 };
60 //------------------------------- Methods ----------------------------------
61 StackAllocator() : ContiguousPoolManager<T>(_buffer, SIZE)
62 {}
63
64 StackAllocator(const this_type&) : StackAllocator()
65 {}
66 StackAllocator(this_type&&) : StackAllocator()
67 {}
68 StackAllocator& operator=(const this_type&) = delete;
69 StackAllocator& operator=(this_type&&) = delete;
70
71 // Rebound types
72 template <typename U>
73 StackAllocator(const StackAllocator<U,SIZE>&) : StackAllocator()
74 {}
75 template <typename U>
76 StackAllocator(StackAllocator<U,SIZE>&&) : StackAllocator()
77 {}
78 template <typename U>
79 StackAllocator& operator=(const StackAllocator<U,SIZE>&) = delete;
80 template <typename U>
81 StackAllocator& operator=(StackAllocator<U,SIZE>&&) = delete;
82
83 static StackAllocator select_on_container_copy_construction(const StackAllocator&) {
84 return StackAllocator();
85 }
86 bool operator==(const this_type& other) const {
87 return this == &other;
88 }
89 bool operator!=(const this_type& other) const {
90 return !operator==(other);
91 }

Calls

no outgoing calls

Tested by

no test coverage detected