【发布时间】:2009-02-23 02:00:18
【问题描述】:
我有以下sn-p:
#include <boost/random/lognormal_distribution.hpp>
#include <boost/random/lagged_fibonacci.hpp>
int main() {
const double mean = 0.0;
const double sigma = 1.0;
boost::lognormal_distribution<double> lognorm_dist(mean, sigma);
boost::lagged_fibonacci44497 engine;
// the following line give error in GCC 3.3
const double value = lognorm_dist.operator() <boost::lagged_fibonacci44497>((engine));
}
在
下编译正常i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
但在:
g++ (GCC) 3.3.3 (SuSE Linux)
它给出了以下错误:
Mycode.cc:10:error: `operator()' not defined
我该如何解决这个问题?
【问题讨论】:
-
struct f { template
void operator()(int) { } }; int main() { f f_; f_.operator() (0); } 这样编译了吗? -
不,它没有。我已经测试了你的 sn-p。
-
你为什么要提供明确的括号?就叫它 lognorm_dist(engine);