다음을 통해 공유


stack::stack (STL/CLR)

어댑터 컨테이너 개체를 만듭니다.

    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

참고 항목

참조

stack (STL/CLR)

stack::assign (STL/CLR)

stack::generic_container (STL/CLR)

stack::operator= (STL/CLR)