简体   繁体   English

两个非类型模板参数常量

[英]two non type template parameter constants

maybe I don't quite understand what's going on behind the scenes, but in my understanding, the compiler is just injecting the parameters and evaluating at compile time, 也许我不太了解幕后情况,但据我了解,编译器只是注入参数并在编译时进行评估,

I'm trying to make a matrix class that uses templates and overloaded operators to enforce matrix multiplication rules with the compiler, 我正在尝试制作一个使用模板和重载运算符的矩阵类,以通过编译器强制执行矩阵乘法规则,

template<unsigned int ROWS,unsigned int COLS>
class Matrix{
    public:
        Matrix<ROWS,COLS>(){
...

doesn't compile though 虽然不编译

are multiple integers as arguments not supported? 是否支持多个整数作为参数? or is there some syntax that I can use to achieve the desired results 还是我可以使用一些语法来达到预期的结果

wow I didn't expect to get responses so fast! 哇,我没想到会收到这么快的答复! after seeing some of the comments, I re-entered the code and it worked, so I guess I must have mis-typed something 看到一些注释后,我重新输入了代码,它开始工作了,所以我想我一定是打错了一些东西

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM