I have a c++ code which heavily uses shared_ptr and STL. A common header says
#include<boost/shared_ptr.hpp> using boost::shared_ptr; // for shared_ptr using namespace std; // for STL I wanted to switch to c++0x now to make use of the language features, using gcc 4.6 with -std=c++0x. There is however std::shared_ptr now as well, leading to ambiguity for unspecified shared_ptr (boost::shared_ptr vs std::shared_ptr).
When switching to std::shared_ptr instead, like this:
#include<memory> using namespace std; // for STL; also imports std::shared_ptr then I am getting problems with boost::python, which works apprently with boost::shared_ptr only (at least without further fiddling):
/usr/include/boost/python/object/make_ptr_instance.hpp:30:52: error: no matching function for call to 'get_pointer(const std::shared_ptr<Cell>&)' My question therefore is
- if there is a simple solution to resolve the ambiguity between
boost::shared_ptrandstd::shared_ptr(other than not using c++0x for now), and also - if
boost::shared_ptrwill eventually be just an alias forstd::shared_ptr; that would solve my problem automatically.
Thanks!
using namespace stdall together. And it could be as simple as doing a global find&replace for every stl element.using std::string; using std::vector;etc declarations in the common header. It is actually not manystd::parts which are used, but they are used very often.using std::cout; using std::stringinside the scope that uses it. That increases readability, especially in less trivial cases (using boost::phoenix::bindorusing boost:bind, orusing boost::spirit::karma::_1etc. Removes any ambiguity (to both compiler and programmers) without cluttering up the actual code)