MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Stack

Class Stack

Source/ThirdParty/rapidjson/internal/stack.h:37–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35*/
36template <typename Allocator>
37class Stack {
38public:
39 // Optimization note: Do not allocate memory for stack_ in constructor.
40 // Do it lazily when first Push() -> Expand() -> Resize().
41 Stack(Allocator* allocator, size_t stackCapacity) : allocator_(allocator), ownAllocator_(0), stack_(0), stackTop_(0), stackEnd_(0), initialCapacity_(stackCapacity) {
42 }
43
44#if false
45 Stack(const Stack& other)
46 : Stack(nullptr, other.initialCapacity_)
47 {
48 if (other.Empty())
49 return;
50 char* dst = Push<char>(other.GetSize());
51 const char* src = other.Bottom<char>();
52 memcpy(dst, src, other.GetSize());
53 }
54#endif
55
56#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
57 Stack(Stack&& rhs)
58 : allocator_(rhs.allocator_),
59 ownAllocator_(rhs.ownAllocator_),
60 stack_(rhs.stack_),
61 stackTop_(rhs.stackTop_),
62 stackEnd_(rhs.stackEnd_),
63 initialCapacity_(rhs.initialCapacity_)
64 {
65 rhs.allocator_ = 0;
66 rhs.ownAllocator_ = 0;
67 rhs.stack_ = 0;
68 rhs.stackTop_ = 0;
69 rhs.stackEnd_ = 0;
70 rhs.initialCapacity_ = 0;
71 }
72#endif
73
74 ~Stack() {
75 Destroy();
76 }
77
78#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
79 Stack& operator=(Stack&& rhs) {
80 if (&rhs != this)
81 {
82 Destroy();
83
84 allocator_ = rhs.allocator_;
85 ownAllocator_ = rhs.ownAllocator_;
86 stack_ = rhs.stack_;
87 stackTop_ = rhs.stackTop_;
88 stackEnd_ = rhs.stackEnd_;
89 initialCapacity_ = rhs.initialCapacity_;
90
91 rhs.allocator_ = 0;
92 rhs.ownAllocator_ = 0;
93 rhs.stack_ = 0;
94 rhs.stackTop_ = 0;

Callers

nothing calls this directly

Calls 2

DestroyFunction · 0.85
SwapFunction · 0.50

Tested by

no test coverage detected