mardi 26 mai 2015

Storing pairs in a GCC rope with c++11

I'm using a GCC extension rope to store pairs of objects in my program and am running into some C++11 related trouble. The following compiles under C++98

#include <ext/rope>

typedef std::pair<int, int> std_pair;

int main()
{
   __gnu_cxx::rope<std_pair> r; 
}

but not with C++11 under G++ 4.8.2 or 4.8.3.

What happens is that the uninitialised_copy_n algorithm is pulled in from two places, the ext/memory and the C++11 version of the memory header. The gnu_cxx namespace is pulled in by rope and the std namespace is pulled in by pair and there are now two identically defined methods in scope leading to a compile error.

I assume this is a bug in a weird use case for a rarely used library but what would be the correct fix? You can't remove the function from ext/memory to avoid breaking existing code and it now required to be in std. I've worked around it using my own pair class but how should this be fixed properly?

Aucun commentaire:

Enregistrer un commentaire