c++ 模板参数错误
代码可以直接在 https://github.com/fengwang/random_variate_generator在线阅读
这样下载源代码:
实现的三个随机数引擎,其中mitchell_moore 和linear_congruential没有问题,就是结构几乎完全一致的mt19937出问题了。
这样下载源代码:
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出问题了。
...全文


