记录详情

Compile Error

/in/foo.cc:26:48: warning: friend declaration 'void Swap(CArrary<T>, CArrary<T>)' declares a non-template function [-Wnon-template-friend]
     friend void Swap(CArrary<T> a, CArrary<T> b);
                                                ^
/in/foo.cc:26:48: note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) 
/in/foo.cc: In member function 'CArrary<T>& CArrary<T>::operator=(const CArrary<T>&)':
/in/foo.cc:99:25: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
                         if(ptr)
                         ^~
/in/foo.cc:101:29: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
                             ptr=new T[a.size];
                             ^~~
/in/foo.cc: In function 'void Swap(CArrary<T>, CArrary<T>)':
/in/foo.cc:112:18: error: expected type-specifier before '[' token
       T * tmp=new[b.size];
                  ^
/in/foo.cc:117:20: error: expected type-specifier before '[' token
           a.ptr=new[b.size];
                    ^
/in/foo.cc:117:20: error: expected ';' before '[' token

信息

递交者
类型
自测
题目
P1012 模板--数组交换
语言
C++
递交时间
2020-04-04 16:27:30
评测时间
2020-04-04 16:27:30
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes