File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -44,34 +44,33 @@ class StackAlloc
44
44
{
45
45
public:
46
46
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;
49
48
50
49
/* * Default constructor */
51
- StackAlloc () {head_ = nullptr ; }
50
+ StackAlloc () {head_ = 0 ; }
52
51
/* * Default destructor */
53
52
~StackAlloc () { clear (); }
54
53
55
54
/* * Returns true if the stack is empty */
56
- bool empty () {return (head_ == nullptr );}
55
+ bool empty () {return (head_ == 0 );}
57
56
58
57
/* * Deallocate all elements and empty the stack */
59
58
void clear () {
60
59
Node* curr = head_;
61
- while (curr != nullptr )
60
+ while (curr != 0 )
62
61
{
63
62
Node* tmp = curr->prev ;
64
63
allocator_.destroy (curr);
65
64
allocator_.deallocate (curr, 1 );
66
65
curr = tmp;
67
66
}
68
- head_ = nullptr ;
67
+ head_ = 0 ;
69
68
}
70
69
71
70
/* * Put an element on the top of the stack */
72
71
void push (T element) {
73
72
Node* newNode = allocator_.allocate (1 );
74
- allocator_.construct (newNode);
73
+ allocator_.construct (newNode, Node () );
75
74
newNode->data = element;
76
75
newNode->prev = head_;
77
76
head_ = newNode;
You can’t perform that action at this time.
0 commit comments