c++ 模板参数错误

fallening fallening 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
代码可以直接在 https://github.com/fengwang/random_variate_generator在线阅读
这样下载源代码:
git clone git://github.com/fengwang/random_variate_generator.git
然后
cd random_variate_generator && make binomial_test
错误如下:
g++ -c -O2 -Wall -g -std=c++0x -Iinclude  -o ./obj/binomial_test.o example/binomial_test.cc
example/binomial_test.cc: In function ‘int main()’:
example/binomial_test.cc:13:45: error: template argument 3 is invalid
example/binomial_test.cc:13:49: error: invalid type in declaration before ‘(’ token
example/binomial_test.cc:13:58: error: initializer expression list treated as compound expression
example/binomial_test.cc:13:58: warning: left-hand operand of comma has no effect
example/binomial_test.cc:16:14: error: request for member ‘begin’ in ‘vg’, which is of non-class type ‘int’
example/binomial_test.cc:16:26: error: request for member ‘begin’ in ‘vg’, which is of non-class type ‘int’
example/binomial_test.cc:18:31: error: request for member ‘begin’ in ‘vg’, which is of non-class type ‘int’
example/binomial_test.cc:18:43: error: request for member ‘begin’ in ‘vg’, which is of non-class type ‘int’
example/binomial_test.cc:18:59: error: unable to deduce ‘auto’ from ‘<expression error>’
make: *** [binomial_test.o] Error 1
gcc 4.5.1 编译错误信息如上,icc 11.1以及ms vc10均可通过。


实现的三个随机数引擎,其中mitchell_moore 和linear_congruential没有问题,就是结构几乎完全一致的mt19937出问题了。
...全文
评论 18
收藏 已收藏
分享
返回顶部
fallening
C++ 语言 65,214 成员 250,514 内容