I'm sure you heard about C++0x, which comes along with a typesafe nullptr. In some open-std-proposal (
Link), the typesafe nullptr to use in the current standard is introduced, take a look:
const // this is a const object...
class {
public:
template<class T> // convertible to any type
operator T*() const // of null non-member
{ return 0; } // pointer...
template<class C, class T> // or any type of null
operator T C::*() const // member pointer...
{ return 0; }
private:
void operator&() const; // whose address can't be taken
} nullptr = {}; // and whose name is nullptr
or, to save lines and chars:
const class {
public:
template<class T> operator T*() const {return 0;}
template<class C, class T> operator T C::*() const {return 0;}
private:
void operator&() const;
} nullptr = {};
It's just a very practical thingy which solves the NULL-problematic:
void foo( int some_value );
void foo( int* some_pointer );
foo( 0 ); // calls foo(int)
foo( NULL ); // calls foo(int)
foo( nullptr ); // calls foo(int*)
I just wanted to tell you about it in case you didn't know and want to use it