STL源码剖析:partial ordering of function templates

来源:互联网 发布:oppoa203软件下载 编辑:程序博客网 时间:2024/06/12 22:55
/*partial ordering of function templates*/#include <iostream>using namespace std;class alloc{};template<class T, class Alloc=alloc>class vector{public:void swap(vector<T, Alloc>&){cout<<"swap()"<<endl;}};#ifdef _STL_FUNCTION_TMPL_PARTIAL_ORDERtemplate <class T, class Alloc>inline void swap(vector<T, Alloc>& x, vector<T, Alloc>& y){x.swap(y);}#endifint main(){vector<int> x;vector<int> y;swap(x, y);system("pause");return 0;}


原创粉丝点击