构造容器适配器对象。
stack();
stack(stack<Value, Container>% right);
stack(stack<Value, Container>^ right);
explicit stack(container_type% wrapped);
参数
right
要复制的对象。包装
使用的包装容器。
备注
构造函数:
stack();
创建一个空的包装容器。使用它指定空的初始控件序列。
构造函数:
stack(stack<Value, Container>% right);
创建一 right.get_container()的副本中包装的容器。将它指定为的复制序列控件按堆栈对象 right的初始控件序列。
构造函数:
stack(stack<Value, Container>^ right);
创建一 right->get_container()的副本中包装的容器。将它指定为的复制序列控件按堆栈对象 *right的初始控件序列。
构造函数:
explicit stack(container_type% wrapped);
使用现有的容器 wrapped 作为包装容器。使用该构造从现有的容器的堆栈。
示例
// cliext_stack_construct.cpp
// compile with: /clr
#include <cliext/stack>
#include <cliext/vector>
typedef cliext::stack<wchar_t> Mystack;
typedef cliext::vector<wchar_t> Myvector;
typedef cliext::stack<wchar_t, Myvector> Mystack_vec;
int main()
{
// construct an empty container
Mystack c1;
System::Console::WriteLine("size() = {0}", c1.size());
// construct from an underlying container
Myvector v2(5, L'x');
Mystack_vec c2(v2);
for each (wchar_t elem in c2.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct by copying another container
Mystack_vec c3(c2);
for each (wchar_t elem in c3.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct by copying another container through handle
Mystack_vec c4(%c2);
for each (wchar_t elem in c4.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
要求
标题: <cliext/堆栈>
命名空间: cliext