I am working on a server with GCC version 4.4.7, and I am forced to work with this version unfortunately. I want to make use of the <random>
library of C++0x, but I read here that in this version uniform_real_distribution
is called uniform_real
. When I try to call this function and normal_distribution
, I don't get useful output. See this example:
#include <random>
#include <iostream>
using namespace std;
int main()
{
typedef std::mt19937 Engine;
typedef std::uniform_real<double> Dis1;
typedef std::normal_distribution<double> Dis2;
Engine eng(0);
Dis1 dis1(0, 1);
cout << dis1(eng) << endl; //OUTPUTS 3.49921e+09
Dis2 dis2(0, 1);
cout << dis2(eng) << endl; //STALLS, NO OUTPUT
return 0;
}
I compile with g++44 -std=c++0x main.cpp
and I have shown what output I get. What is the issue here?
C++11 support in gcc 4.4 is rather sparse.
The release notes for gcc 4.5 include
Improved experimental support for the upcoming ISO C++ standard, C++0x
specifically mentioning <random>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With