[Random] newbie question on saving the generator state through stream operators

Hello, I have found another post on the subject, but it seems that no response has followed (maybe the answer is so obvious...). http://thread.gmane.org/gmane.comp.lib.boost.user/3901/focus=3901 However, even in http://www.boost.org/libs/random/random_demo.cpp it is suggested to "Try boost::mt19937 or boost::ecuyer1988 instead of boost::minstd_rand", but the following code (taken from the same file) seems to work only when "generator" is of type boost::minstd_rand. // You can save the generator state for future use. You can read the // state back in at any later time using operator>>. std::ofstream file("rng.saved", std::ofstream::trunc); file << generator; I'm using bcb and get the following compiler error message when "generator" is not of type boost::minstd_rand (but is boost::mt19937, for example): "'operator<<' not implemented in type '_STL::ofstream' for arguments of type 'boost::mt19937'". Any help would be appreciated, thanks in advance, Marco -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.7/436 - Release Date: 01/09/2006
participants (1)
-
Marco Baldi