Skip to content

Commit ea19a70

Browse files
committed
Update StackAlloc.h
1 parent 4c67b02 commit ea19a70

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

StackAlloc.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,33 @@ class StackAlloc
4444
{
4545
public:
4646
typedef StackNode_<T> Node;
47-
typedef typename std::allocator_traits<Alloc>::template rebind_alloc<Node>
48-
allocator;
47+
typedef typename Alloc::template rebind<Node>::other allocator;
4948

5049
/** Default constructor */
51-
StackAlloc() {head_ = nullptr; }
50+
StackAlloc() {head_ = 0; }
5251
/** Default destructor */
5352
~StackAlloc() { clear(); }
5453

5554
/** Returns true if the stack is empty */
56-
bool empty() {return (head_ == nullptr);}
55+
bool empty() {return (head_ == 0);}
5756

5857
/** Deallocate all elements and empty the stack */
5958
void clear() {
6059
Node* curr = head_;
61-
while (curr != nullptr)
60+
while (curr != 0)
6261
{
6362
Node* tmp = curr->prev;
6463
allocator_.destroy(curr);
6564
allocator_.deallocate(curr, 1);
6665
curr = tmp;
6766
}
68-
head_ = nullptr;
67+
head_ = 0;
6968
}
7069

7170
/** Put an element on the top of the stack */
7271
void push(T element) {
7372
Node* newNode = allocator_.allocate(1);
74-
allocator_.construct(newNode);
73+
allocator_.construct(newNode, Node());
7574
newNode->data = element;
7675
newNode->prev = head_;
7776
head_ = newNode;

0 commit comments

Comments
 (0)