Home Dashboard Directory Help
Search

In Visual C++ 2010, std::tr1::shuffle_order_engine incorrectly defines min and max members, rendering the class (and std::tr1::knuth_b) unusable by ildjarn


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 560987
Opened: 5/23/2010 10:20:16 PM
Access Restriction: Public
0
Workaround(s)
view
1
User(s) can reproduce this bug

Description

std::tr1::shuffle_order_engine defines min and max as static member functions, when they should be instance member functions. Similarly, they forward to the contained _Engine's min and max member functions incorrectly, calling them as though they're static when in reality they're instance.

The result of this is that any instantiation and attempted use of shuffle_order_engine (and thus knuth_b) fails to compile.

The apparent fix is to change the following in shuffle_order_engine's class template definition in <random> from:

    static result_type (min)()
        {    // return minimum possible generated value
        return ((_Engine::min)());
        }

    static result_type (max)()
        {    // return maximum possible generated value
        return ((_Engine::max)());
        }


To:

    result_type (min)() const
        {    // return minimum possible generated value
        return (_Eng.min());
        }

    result_type (max)() const
        {    // return maximum possible generated value
        return (_Eng.max());
        }
Details
Sign in to post a comment.
Posted by Microsoft on 7/27/2010 at 3:46 PM
Hi,

Thanks for reporting this bug. We've fixed it, and the fix will appear in VC11. The fix was actually to make minstd_rand0 and minstd_rand typedefs for linear_congruential_engine instead of the older linear_congruential.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 5/24/2010 at 11:06 PM
Thanks for your feedback. We were able to reproduce the issue you are seeing. We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by Microsoft on 5/24/2010 at 4:02 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.