hhinnant at apple.com
Thu Apr 5 14:39:52 PDT 2012
On Apr 5, 2012, at 5:00 PM, Fletcher, John P wrote:
> I am attempting to convert some code which compiles with g++ 4.4 to work with Clang31 and libc++.
> The code includes <tr1/random> which exists in the g++ includes but not in libcxx/include.
> libc++ does have a file <random> which does have most of the things needed but not the template class variate_generator defined like this in <tr1/random>
> template<typename _Engine, typename _Dist>
> class variate_generator
> Is there an equivalent in libc++ or should I just import the g++ 4.4 file?
> P.S. The full set of defines being made in the code are:
> std::tr1::mt19937 uint_gen;
> std::tr1::uniform_real<double> uniform_dist;
> std::tr1::variate_generator< std::tr1::mt19937, std::tr1::uniform_real<double> > uniform_gen;
> std::tr1::normal_distribution<double> normal_dist;
> std::tr1::variate_generator< std::tr1::mt19937, std::tr1::normal_distribution<double> > normal_gen;
libc++ does not implement TR1, but does have a complete implementation of C++11. In C++11 <random> is in namespace std, not std::tr1. Also variate_generator was removed from the C++11 spec in N1933 dated 2006-02-23. The rationale for this removal is in the paper and will likely more clearly explain how to modify your code than I could here. Here is a link to the paper:
More information about the cfe-dev