Skip to content

CStack<T>

CStack

CStack is a generic class that implements the ICollection interface.

Description

The CStack class is a dynamic collection of T type data, which is organized as a stack that operates on the LIFO (last in, first out) principle.

Declaration

template<typename T>
   class CStack : public ICollection<T>

Header

#include <Generic\Stack.mqh>

Inheritance Hierarchy

ICollection

CStack

Class Methods

MethodDescription
AddAdds an element to a stack
CountReturns the number of elements in a stack
ContainsDetermines whether a stack contains an element with the specified value
TrimExcessSets the capacity of a stack to the actual number of elements
CopyToCopies all elements of a stack to the specified array starting at the specified index
ClearRemoves all elements from a stack
RemoveRemoves the first occurrence of the specified element from a stack
PushAdds an element to a stack
PeekReturns the head element without removing it from a stack
PopReturns the head element and removes it from a stack
Last updated on