为什么用标准模板库的stack<int>&作形参会显示没定义
t.h文件
#ifndef T_H #define T_H #include<stack> using namespace std; void out(stack<int>&); #endif
#include<stack> using namespace std; void out(stack<int>&a) { a.push(1); a.push(2); while(!a.empty()) { cout<<a.top()<<endl; a.pop(); } }
#include<iostream> using namespace std; #include "t.h" int main() { stack<int>a; out(a); return 0; }
#include "t.h"#include<iostream>using namespace std;void out(stack<int>&a) { a.push(1); a.push(2); while(!a.empty()) { cout<<a.top()<<endl; a.pop(); } }