I have this situation where the library I use has many functions that return raw pointers to objects, how could I now use boost smart pointers in my program using this library and using smart pointers?
The library is xerces-C++ and an example is getting the document iterator:
boost::shared_ptr<DOMNodeIterator> itera = document->createNodeIterator(rootelement, DOMNodeFilter::SHOW_ALL, NULL, true);
The createNodeIterator
function returns a pointer to a DOMNodeIterator
object, this is a raw pointer and therefore cannot be cast just like that to a boost::shared_ptr
... How would I best deal with this? Use raw pointers instead?