c++??????е????????????幹????
???????????? ???????[ 2016/10/10 9:57:45 ] ?????????????? C++
??????????????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?????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11