1
"cannot declare a class template with no name"
由鐺給出++具有下列文件,「Foo.cpp中」:
#ifndef foo
#define foo
template <class T>
struct foo {
private:
const T t;
};
#endif
命令行輸入錯誤:
[email protected]$ clang++ -c foo.cpp
foo.cpp:5:1: error: cannot declare a class template with no name
你知道預處理器做什麼?在該文件中的前兩行之後,想象*每*符號'foo'取代爲...什麼被定義爲一次'foo'?哦,是的... *沒有*。 – WhozCraig
你是相當魔術師。 – TemplateRex