[cfe-dev] libc++, std::bind, and <random>
Steven Watanabe
watanabesj at gmail.com
Mon Apr 11 08:30:16 PDT 2011
AMDG
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);
>> }
>
> Clang outputs the following error for this program:
>
>> In file included from test.c++:2:
>> /usr/include/c++/v1/random:2234:9: error: no member named 'generate' in 'std::__1::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11,
>> 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>'
>> __q.generate(__ar, __ar + __n * __k);
>> ~~~ ^
>
> It looks to me like clang supports all the features necessary, and the code runs as expected in VS2010. Here's the command line I used:
>
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.
The two declarations in question are:
mersenne_twister(const mersenne_twister&);
template<typename SeedSeq> mersenne_twister(SeedSeq&);
In Christ,
Steven Watanabe
More information about the cfe-dev
mailing list