Поделиться через


stack (STL/CLR)

The template class describes an object that controls a varying-length sequence of elements that has last-in first-out access. You use the container adapter stack to manage an underlying container as a push-down stack.

In the description below, GValue is the same as Value unless the latter is a ref type, in which case it is Value^. Similarly, GContainer is the same as Container unless the latter is a ref type, in which case it is Container^.

template<typename Value,
    typename Container>
    ref class stack
        :   public
        System::ICloneable,
        Microsoft::VisualC::StlClr::IStack<GValue, GContainer>
    { ..... };

Parameters

  • Value
    The type of an element in the controlled sequence.

  • Container
    The type of the underlying container.

Members

Type Definition

Description

stack::const_reference (STL/CLR)

The type of a constant reference to an element.

stack::container_type (STL/CLR)

The type of the underlying container.

stack::difference_type (STL/CLR)

The type of a signed distance between two elements.

stack::generic_container (STL/CLR)

The type of the generic interface for the container adapter.

stack::generic_value (STL/CLR)

The type of an element for the generic interface for the container adapter.

stack::reference (STL/CLR)

The type of a reference to an element.

stack::size_type (STL/CLR)

The type of a signed distance between two elements.

stack::value_type (STL/CLR)

The type of an element.

Member Function

Description

stack::assign (STL/CLR)

Replaces all elements.

stack::empty (STL/CLR)

Tests whether no elements are present.

stack::get_container (STL/CLR)

Accesses the underlying container.

stack::pop (STL/CLR)

Removes the last element.

stack::push (STL/CLR)

Adds a new last element.

stack::size (STL/CLR)

Counts the number of elements.

stack::stack (STL/CLR)

Constructs a container object.

stack::top (STL/CLR)

Accesses the last element.

stack::to_array (STL/CLR)

Copies the controlled sequence to a new array.

Property

Description

stack::top_item (STL/CLR)

Accesses the last element.

Operator

Description

stack::operator= (STL/CLR)

Replaces the controlled sequence.

operator!= (stack) (STL/CLR)

Determines if a stack object is not equal to another stack object.

operator< (stack) (STL/CLR)

Determines if a stack object is less than another stack object.

operator<= (stack) (STL/CLR)

Determines if a stack object is less than or equal to another stack object.

operator== (stack) (STL/CLR)

Determines if a stack object is equal to another stack object.

operator> (stack) (STL/CLR)

Determines if a stack object is greater than another stack object.

operator>= (stack) (STL/CLR)

Determines if a stack object is greater than or equal to another stack object.

Interfaces

Interface

Description

ICloneable

Duplicate an object.

IStack<Value, Container>

Maintain generic container adapter.

Remarks

The object allocates and frees storage for the sequence it controls through an underlying container, of type Container, that stores Value elements and grows on demand. The object restricts access to pushing and popping just the last element, implementing a last-in first-out queue (also known as a LIFO queue, or stack).

Requirements

Header: <cliext/stack>

Namespace: cliext

See Also

Reference

deque (STL/CLR)

list (STL/CLR)

priority_queue (STL/CLR)

queue (STL/CLR)

vector (STL/CLR)

Other Resources

STL/CLR Library Reference