jeudi 25 juin 2015

Placing C++ libs out of global namespace

So I'm building a c++11 library based on other libraries like opengl, SDL2, assimp,glm, etc... Only problem is that most of those libraries place their functions, or objects in the global namespace : this may conflict with my classes ! (for ex. assimp vectors and my Vector class...) So I thought of putting the libraries in a namespace instead of leaving them there to "pollute" the global namespace.

I thought of doing this :

namespace some_name_space
{
   #include <some/kind/of/lib>
}

But I realized that there would still be a part of the library in the global namespace !

Any suggestions on how achieve this ?

PS : I could "wrap" the libs, but that wouldn't really be managable !

Aucun commentaire:

Enregistrer un commentaire