Opened 15 years ago
Closed 14 years ago
#1068 closed Bugs (fixed)
Mersenne twister disables streaming for Visual C++
Reported by: | Owned by: | No-Maintainer | |
---|---|---|---|
Milestone: | To Be Determined | Component: | random |
Version: | Severity: | Problem | |
Keywords: | Cc: |
Description
boost/mersenne_twister.hpp disables the streamable concept because boost config machinery says that vc 7.1/8 cannot handle member template friends. This appears not to be the case.
To work around it, I do the following:
This hack is necessary because boost thinks that Visual C++ still cannot handle member function templates It is needed to make mersenne_twister streamable #include <boost/config.hpp> #if defined(BOOST_MSVC) && defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) # undef BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define FINCAD_BOOST_RNG_HACK #endif
#include <boost/random/mersenne_twister.hpp>
#ifdef FINCAD_BOOST_RNG_HACK # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # undef FINCAD_BOOST_RNG_HACK #endif
I don't know how you would fix it for the twister. It really sounds like a config machinery issue but it affects the mersenne twister code negatively.
Change History (3)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Owner: | set to |
---|
comment:3 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This also seems to be the case for uniform_int - removing the
around the streaming operators in uniform_int.hpp allows me to stream a uniform_int in and out of a std::stringstream in both VC7.1/VC8.
I haven't tried doing this with any other Random classes yet - might be worth a try to see what happens though.