??????????????c++??????е????????????幹?????????????????????????????
???????????????????
????????????????????????????????????????????в???????????????????????????????????????????????????????????????????????????????????????
????template <class T>
????class test
????{
????template <class U> friend ostream& operator<< (ostream &os?? const test<U> &obj); //?????????????????з????
????...
????};
????class test;
????template <class Type> ostream& operator<< (ostream &os?? const test<Type> &obj);
????template <class T>
????class test
????{
????friend ostream& operator<< <T> (ostream &os?? const test<T> &obj);//??????T??????????з????
????...
????};
??????幹??????
???????????????У???????????幹???????????????????ù?????????е???з?????幹??????????????????幹??????????????????????幹??????????????????????????????忽?????????????????????????????????????????
????template <class T>
????class test
????{
????public:
????test() { cout << "in my test construct" << endl;}
????test(const test &) { cout << "in my test copy" << endl;}
????template <class V>
????test(const test<V> &) { cout << "in my template copy" << endl;}
????};
????int main()
????{
????test<int> t1;
????test<int> t2(t1);
????test<double> t3(t1);
????return 0;
????}
????????? template <class V> test(const test<V> &) ??????y????????????????????????????test<T>???????????test<V>????????????????????????????????????????int????????飬?????????????double??????????????????????????????????????
?????????????????
????in my test construct
????in my test copy
????in my template copy
??????stl??pair??auto_ptr?????????