Boost C++ Libraries: Ticket #2424: unsigned int causes error in seed() without static_cast https://svn.boost.org/trac10/ticket/2424 <p> I posted this to the boost-user mailing list and it was recommended to file a ticket here. </p> <p> 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: </p> <pre class="wiki">boost::mt19937 rng; unsigned int rseed = static_cast&lt;unsigned int&gt;(std::time(0)); rng.seed( rseed ); // This causes an error rng.seed( static_cast&lt;unsigned int&gt;(rseed) ); // This works </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2424 Trac 1.4.3 Steven Watanabe Sat, 06 Jun 2009 19:41:40 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2424#comment:1 https://svn.boost.org/trac10/ticket/2424#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/53699" title="Fix overload resolution for generator constructors/seed. Fixes #351. ...">[53699]</a>) Fix overload resolution for generator constructors/seed. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/351" title="#351: Bugs: Diff in state of mersenne_twister gen between GCC3.41 &amp; CW9 (closed: fixed)">#351</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2424" title="#2424: Bugs: unsigned int causes error in seed() without static_cast (closed: fixed)">#2424</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2887" title="#2887: Bugs: mersenne_twister generated copy ctor overloaded by a template ctor (closed: fixed)">#2887</a> </p> Ticket