On 01/24/05 16:13:00, Luca Berardi wrote:
>
> The
piece of code:
>
>
BoxMullerGaussianRng<MersenneTwisterUniformRng>
>
generator( MersenneTwisterUniformRng() );
> Z =
generator.next().value;
>
> generates the following
error:
>
> left of '.next' must have class/struct/union type
>
type is
'overloaded-function'
Luca,
you've been bitten by the infamous "C++ most vexing parse."
The
compiler parses the first statement as the declaration of a
function called
'generator' which returns a
BoxMuller<MersenneTwister> and takes as
argument a function with
no arguments and returning a MersenneTwister (yes,
it can be parsed
this way. And yes, for some reason the C++ standard
_requires_ it to be
parsed this way. Most vexing indeed.)
> When compiling the same
piece of code with Visual C++ 6.0 I didn't get
> any
errors
VC6 didn't follow the C++ standard :)
You can fix the code
by rephrasing the variable declaration so that it
can't be parsed as a
function. Something like
MersenneTwisterUniformRng
twister;
BoxMullerGaussianRng<MersenneTwisterUniformRng> generator(
twister );
should
work.
Later,
Luigi
-------------------------------------------------------
This
SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for
open source databases. Create drag-&-drop reports. Save time
by over 75%!
Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE
copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Quantlib-users
mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
| Free forum by Nabble | Edit this page |