【发布时间】:2014-02-04 12:47:44
【问题描述】:
我不明白以下构造函数(src\corelib\tools\qstringbuilder.h 中 Qt 库的一部分),它是什么意思,它是如何工作的?
class QLatin1Literal
{
public:
int size() const { return m_size; }
const char *data() const { return m_data; }
template <int N>
QLatin1Literal(const char (&str)[N])
: m_size(N - 1), m_data(str) {}
private:
const int m_size;
const char * const m_data;
};
【问题讨论】:
-
N 这里是一个非类型模板参数。