I have the following snippet:
#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)); }
It compile fine under
i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)
But under:
g++ (GCC) 3.3.3 (SuSE Linux)
It gave the following error:
Mycode.cc:10:error: `operator()' not defined
How can I fix the problem?
Why not just
lognorm_dist( engine );? Providing ‘function-like’ syntax is the whole point of operator(). That said,lognorm_dist.template operator() <boost::lagged_fibonacci44497>((engine))should solve your compilation issues if I am not mistaken.