/* * Copyright (c) 2001 by Cliff Green. All rights reserved. Individual files * may be covered by other copyrights (as noted in the file itself). * * Redistribution and use in source and binary forms are permitted * provided that this entire copyright notice is duplicated in all such * copies. * * This software is provided "as is" and without any expressed or implied * warranties, including, without limitation, the implied warranties of * merchantibility and fitness for any particular purpose. */ //---------------------------------------------------------------------- // Copyright note - Nathan Meyers wrote the original version and my standard // copyright notice above only pertains to my modified version of his // function. //---------------------------------------------------------------------- // Source file: nil.h // Written by: Cliff Green, 1999 // Compiler: Metrowerks CodeWarrior Pro 6 // History: // Modified: 8/15/2000 // By: Cliff Green // Comments: Initial creation //---------------------------------------------------------------------- // This commentheader supports documentation tools such as Doc++ and // Doxygen: http://www.doxygen.org/ //---------------------------------------------------------------------- /// Pass an object of the right type, null ptr of the same type is returned. /** * Pass a convenient object of the right type, and the nil function * returns a null pointer of the same type. This function is taken from * a Usenet post by Nathan Meyers. * * Usage: * #include "nil.h" * Foo f; * return Util::nil(f); // same as return (Foo*)0; */ #ifndef NIL_H // Standard multiple-inclusion boilerplate #define NIL_H namespace Util { template inline T* nil(T&) { return (T*) 0; } } // end of namespace #endif // NIL_H