15 #ifndef RAPIDJSON_INTERNAL_STACK_H_ 16 #define RAPIDJSON_INTERNAL_STACK_H_ 18 #include "../allocators.h" 21 #if defined(__clang__) 23 RAPIDJSON_DIAG_OFF(
c++98-compat)
35 template <
typename Allocator>
43 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS 53 rhs.ownAllocator_ = 0;
57 rhs.initialCapacity_ = 0;
65 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS 79 rhs.ownAllocator_ = 0;
83 rhs.initialCapacity_ = 0;
124 return PushUnsafe<T>(
count);
145 return reinterpret_cast<T*
>(
stackTop_ -
sizeof(
T));
151 return reinterpret_cast<T*
>(
stackTop_ -
sizeof(
T));
190 newCapacity += (newCapacity + 1) / 2;
193 if (newCapacity < newSize)
194 newCapacity = newSize;
226 #if defined(__clang__) 230 #endif // RAPIDJSON_STACK_H_ size_t initialCapacity_
Definition: stack.h:220
void Swap(T &a, T &b) RAPIDJSON_NOEXCEPT
Custom swap() to avoid dependency on C++ <algorithm> header.
Definition: swap.h:33
A type-unsafe stack for storing different types of data.
Definition: stack.h:36
const T * Top() const
Definition: stack.h:149
Allocator & GetAllocator()
Definition: stack.h:170
void ShrinkToFit()
Definition: stack.h:100
#define RAPIDJSON_NEW(x)
! customization point for global new
Definition: rapidjson.h:586
size_t GetSize() const
Definition: stack.h:176
GLsizeiptr size
Definition: glext.h:6559
void Swap(Stack &rhs) RAPIDJSON_NOEXCEPT
Definition: stack.h:89
const T * End() const
Definition: stack.h:158
char * stackTop_
Definition: stack.h:218
void Expand(size_t count)
Definition: stack.h:181
T * End()
Definition: stack.h:155
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:119
RAPIDJSON_FORCEINLINE T * Push(size_t count=1)
Definition: stack.h:122
const GLubyte * c
Definition: glext.h:9812
GLuint GLuint GLsizei count
Definition: glext.h:6292
void Destroy()
Definition: stack.h:206
Stack & operator=(const Stack &)
void Clear()
Definition: stack.h:98
const T * Bottom() const
Definition: stack.h:164
T * Bottom()
Definition: stack.h:161
T * Pop(size_t count)
Definition: stack.h:136
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:402
~Stack()
Definition: stack.h:61
Definition: document.h:391
#define RAPIDJSON_UNLIKELY(x)
Compiler branching hint for expression with low probability to be true.
Definition: rapidjson.h:468
bool Empty() const
Definition: stack.h:175
#define RAPIDJSON_DELETE(x)
! customization point for global delete
Definition: rapidjson.h:590
bool HasAllocator() const
Definition: stack.h:166
T * Top()
Definition: stack.h:143
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:116
Allocator * ownAllocator_
Definition: stack.h:216
Allocator * allocator_
Definition: stack.h:215
char * stack_
Definition: stack.h:217
void Resize(size_t newCapacity)
Definition: stack.h:199
RAPIDJSON_FORCEINLINE void Reserve(size_t count=1)
Definition: stack.h:115
Stack(Allocator *allocator, size_t stackCapacity)
Definition: stack.h:40
char * stackEnd_
Definition: stack.h:219
RAPIDJSON_FORCEINLINE T * PushUnsafe(size_t count=1)
Definition: stack.h:128
size_t GetCapacity() const
Definition: stack.h:177