模板類我想創建一個模板類的靜態函數靜態函數
template <typename T>
class Memory
{
public:
template < typename T>
static <T>* alloc(int dim)
{
T *tmp = new T [ dim ];
return tmp;
};
}
,但我總是會得到
int *a = Memory::alloc<int>(5)
我不知道該怎麼機會..
»template<class T> class Memory« used without template parameters
expected primary-expression before »int«
Fehler: expected »,« or »;« before »int«
我不編譯,最後一個codebox是問題:) – Roby 2012-04-28 12:55:10
@Tudor:鑑於OP發佈了編譯器錯誤消息,大概不是! – 2012-04-28 12:55:11