Hi,
I am currently trying to fix a few weaknesses in our code base by introducing the use of smart pointers. The code base is very large, and interlinked like a spider who's had one to many coffee's.
I was wondering if people had tried the before and what their approach was.
My first step has been to typedef classes, as follows.
#ifndef USE_SMART_POINTERS
#define USE_SMART_POINTERS 0
#endif
#if USE_SMART_POINTERS == 1
#include <boost/smart_ptr.hpp>
#endif
namespace ProductX
{
// forward decleration
class CTObject;
//typedefs
#if USE_SMART_POINTERS == 1
typedef boost::shared_ptr<CTObject> CTObjectPtr;
#else
typedef CTObject* CObjectPtr;
#endif
}
Now I realise this will lead to a wealth of compile areas, things like
CTObjectPtr i = NULL;
Will completly bork when smart pointers are enabled.
I was wondering if there was anything I could do at this early stage to reduce the mass of compile errors, or is it as I suspect just take things on a case by case basis.
Cheers Rich