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