Question

I can specify -std=c++0x for compilation with my g++ 4.4, and initializer lists are correct, I may use them (in c++98 I can't) but still get errors when try use auto keyword:

std::list< std::vector<int> > li2;

li2.push_back({1, 2, 3}); //push_back vector
li2.push_back({4, 2, 6}); //again, vector implicitly

for (auto& vv : li2) {
    for (auto &i : v)
        printf("element: %d\n", 8);

}

so I assume I can't use C++11 functionallities with g++4.4. I have 4.4 because of compatibility with CUDA.

Était-ce utile?

La solution

This link shows you the different C++11 features supported by GCC. auto appeared in GCC 4.4.

Your real problem is probably that the ranged-based for loop appeared only in GCC 4.6.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top