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

John McCall rjmccall at apple.com
Sun Apr 10 22:46:35 PDT 2011


On Apr 10, 2011, at 10:18 PM, Seth Cantrell wrote:
> Should the following work with clang and libc++?

It certainly should.

>> #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's not clear to me why this is getting instantiated and with what
arguments.  Can you post the full instantiation backtrace, i.e. all the
messages and not just the ultimate error?

John.



More information about the cfe-dev mailing list