8
未定义对静态const int的引用
我今天遇到了一个有趣的问题。考虑以下简单示例: template <typename T> void foo(const T & a) { /* code */ } // This would also fail // void foo(const int & a) { /* code */ } class Bar { public: static const int kConst = 1; void func() { foo(kConst); // This is the important line …