26 #ifndef RAPIDJSON_INTERNAL_STACK_H_
27 #define RAPIDJSON_INTERNAL_STACK_H_
38 template <
typename Allocator>
57 T*
Push(
size_t count = 1) {
62 size_t new_size =
GetSize() +
sizeof(T) * count;
63 if (new_capacity < new_size)
64 new_capacity = new_size;
76 T*
Pop(
size_t count) {
Concept for allocating, resizing and freeing memory block.
A type-unsafe stack for storing different types of data.
Definition: stack.h:39
T * Bottom()
Definition: stack.h:89
char * stack_
Definition: stack.h:98
~Stack()
Definition: stack.h:49
size_t GetCapacity() const
Definition: stack.h:93
Stack(Allocator *allocator, size_t stack_capacity)
Definition: stack.h:41
void Clear()
Definition: stack.h:54
T * Pop(size_t count)
Definition: stack.h:76
T * Push(size_t count=1)
Definition: stack.h:57
Allocator * own_allocator_
Definition: stack.h:97
size_t GetSize() const
Definition: stack.h:92
size_t stack_capacity_
Definition: stack.h:101
char * stack_top_
Definition: stack.h:99
T * Top()
Definition: stack.h:83
char * stack_end_
Definition: stack.h:100
Allocator & GetAllocator()
Definition: stack.h:91
Allocator * allocator_
Definition: stack.h:96
Definition: document.h:38
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:105