Non-copyable KnuthUniformRng
Posted by
Slava Mazur-2 on
URL: http://quantlib.414.s1.nabble.com/Non-copyable-KnuthUniformRng-tp8866.html
The following declaration in KnuthUniformRng effectively makes this class non-copyable:
std::vector<double>::const_iterator ranf_arr_ptr, _arr_sentinel;
However, KnuthUniformRng is not declared as such. As a result, any attempt to call next() of a copy of any temporal instance of KnuthUniformRng ends up in a crash (let me know if further elaboration is needed). I don't believe this is an intended design. There are two possible ways to fix: either to keep indices instead of const_iterator, or to implement a copy constructor and an assignment operator. I personally prefer the former, but can provide any fix community will choose.
Best,
Slava Mazur
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev