#include "pch.h"
#include <iostream>
#include <vector>
using namespace std;
template <class T, class _Container = vector<T> >//typename和class左右相同
class Stack
{
public:
bool empty(){
return a.empty();
}
void push(T _input){
a.push_back(_input);
}
void pop(){
a.pop_back();
}
T top(){
return a.back();
}
int size(){
return a.size();
}
private:
vector<T> a;
};
void text1()
{
Stack<int> a;//<>里的类型指明了模板参数的实际类型
for (int i = 0; i < 10; i++){
a.push(i);
}
while(!a.empty()){
cout << a.top()<<endl;
a.pop();
}
}
int main(){
text1();
}