Problems with the C ++ 11 library and g ++ 4.4.7

I work on a server with GCC version 4.4.7, and I am forced to work with this version, unfortunately. I want to use the library <random>for C ++ 0x, but I read here what is uniform_real_distributioncalled in this version uniform_real. When I try to call this function and normal_distribution, I do not get a 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 showed what result I get. What is the problem?

+5
source share
1 answer

Support for C ++ 11 in gcc 4.4 is pretty poor.

Gcc 4.5 release notes include

Improved experimental support for the upcoming ISO C ++, C ++ 0x standard

, <random>.

+4

All Articles