很难清楚解释,所以对于不清楚的标题感到抱歉。我需要模板类,它将字符串列表(char *?)作为模板参数。这个类必须有静态方法static string get(int i);
,它将返回作为模板静态列表字符串传递的第n个字符串。它如何编码?以字符串列表作为模板参数的模板静态类,如何在C++上编写11
目标是让子类具有指定的字符串列表。事情是这样的:
class Letters : public Base<"A", "B", "C"> {};
...
std::cout << Letters::get(1);
http://stackoverflow.com/questions/1826464/c-style-strings-as-template-arguments –