jeudi 3 septembre 2020

Vector in GCC 4.4.7 Vs GCC 4.9.2

I have a code like below.

void func() 
{
    typedef map<pair<uint,ulong>, pair<int,int> > MyMap;
    MyMap myMap;
    vector<MyMap::value_type> mapVector;
    //...
    for(MyMap::iterator it = myMap.begin(); it != myMap.end(); it++)
    {
        //if(...)
            mapVector.push_back(*it);
    }
    //...
}

It compiles fine with -std=gnu++11 option in GCC 4.9.2, see here but fails with -std=gnu++0x option in GCC 4.4.7, see here. The failure is in operator= on const pair. So how does it work with GCC 4.9.2? Can someone shed light on this difference? Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire