Questions tagged «template-classes»

5
如何在for循环中使用const变量来生成模板类?
我有一个类似的代码 template <size_t N> class A { template <size_t N> someFunctions() {}; }; 现在,我想创建该类的实例,并在for循环中为一组许多值(例如, // in main() int main() { for (int i = 1; i <= 100; i++) { const int N = i; // dont know how to do this A<N> a; a.functionCalls(); } } 这个怎么做?希望有一种方法可以做到这一点。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.