stack::top_item (STL/CLR)
마지막 요소에 액세스합니다.
property value_type top_item;
설명
속성이 비어 있어야 제어 된 시퀀스의 마지막 요소에 액세스 합니다.그 존재를 알고 있는 경우 마지막 요소를 쓰기 사용 합니다.
예제
// cliext_stack_top_item.cpp
// compile with: /clr
#include <cliext/stack>
typedef cliext::stack<wchar_t> Mystack;
int main()
{
Mystack c1;
c1.push(L'a');
c1.push(L'b');
c1.push(L'c');
// display initial contents " a b c"
for each (wchar_t elem in c1.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// inspect last item
System::Console::WriteLine("top_item = {0}", c1.top_item);
// alter last item and reinspect
c1.top_item = L'x';
for each (wchar_t elem in c1.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
요구 사항
헤더: < cliext/스택 >
네임 스페이스: cliext