表示作为元素存储的对象的类型在堆栈的类型。
typedef typename Container::value_type value_type;
备注
该类型是堆栈适合的基容器的 value_type 的同义词。
示例
// stack_value_type.cpp
// compile with: /EHsc
#include <stack>
#include <iostream>
int main( )
{
using namespace std;
// Declares stacks with default deque base container
stack<int>::value_type AnInt;
AnInt = 69;
cout << "The value_type is AnInt = " << AnInt << endl;
stack<int> s1;
s1.push( AnInt );
cout << "The element at the top of the stack is "
<< s1.top( ) << "." << endl;
}
要求
标头: <stack>
命名空间: std