U E D R , A S I H C RSS

[Lovely]boy^_^/Temp

~cpp 
#include <iostream>
using namespace std;

template <typename T>
inline void SAFE_DELETE(T*& arg)
{
	if(arg)
	{
		delete arg;
		arg = NULL;
	}
}

int main()
{
	int* i = new int(5);

	SAFE_DELETE(i);
	SAFE_DELETE(i);
	SAFE_DELETE(i);
	SAFE_DELETE(i);

	return 0;
}

*& 요렇게 생긴걸 이럴때 쓰는구나.
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-05-27 07:09:19
Processing time 0.0098 sec