Opened 14 years ago
Closed 13 years ago
#2424 closed Bugs (fixed)
unsigned int causes error in seed() without static_cast
Reported by: | Owned by: | No-Maintainer | |
---|---|---|---|
Milestone: | Boost 1.37.0 | Component: | random |
Version: | Boost 1.36.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I posted this to the boost-user mailing list and it was recommended to file a ticket here.
One must cast a variable as an unsigned int in the seed() function (even though the variable is declared as an unsigned int). Here's a minimal code segment that replicates the behavior:
boost::mt19937 rng; unsigned int rseed = static_cast<unsigned int>(std::time(0)); rng.seed( rseed ); // This causes an error rng.seed( static_cast<unsigned int>(rseed) ); // This works
Note:
See TracTickets
for help on using tickets.
(In [53699]) Fix overload resolution for generator constructors/seed. Fixes #351. Fixes #2424. Fixes #2887