[cfe-dev] libc++, std::bind, and <random>

Steven Watanabe watanabesj at gmail.com
Mon Apr 11 08:32:22 PDT 2011


AMDG

On 04/11/2011 08:30 AM, Steven Watanabe wrote:
> On 04/10/2011 10:18 PM, Seth Cantrell wrote:
>> Should the following work with clang and libc++?
>>
>>> #include<functional>
>>> #include<random>
>>>
>>> int main(int argc,char const *argv[]) {
>>> std::mt19937 re;
>>> std::normal_distribution<> di(30,8);
>>> auto rand = std::bind(di,re);
>>> }
>> <snip>
>
> When calling the copy constructor of a Random
> Number Engine with a non-const argument, the library is
> incorrectly treating the argument as a SeedSeq.
>

Of course, you probably should use std::ref
to avoid copying the engine.

In Christ,
Steven Watanabe



More information about the cfe-dev mailing list