[cfe-dev] libc++, std::bind, and <random>
Howard Hinnant
hhinnant at apple.com
Mon Apr 11 11:27:22 PDT 2011
On Apr 11, 2011, at 1:18 AM, 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:
>
>> clang++ -stdlib=libc++ -std=c++0x -U__STRICT_ANSI__ -pedantic -fno-blocks -frtti -g test.c++
>
> I'm using revision 129268 of libc++ and clang -v outputs:
>
>> clang version 3.0 (http://llvm.org/git/clang.git 067bbd0e11c71a33b51832532e836971be697699)
>> Target: x86_64-apple-darwin10
>> Thread model: posix
Fix Committed revision 129285.
Thanks,
Howard
More information about the cfe-dev
mailing list