template <class target_type, class source_type>
target_type *cast_or_throw(source_type &to_cast, const target_type &ignored)
{
- if (!&ignored) {} // do nothing.
+// if (!&ignored) {} // do nothing.
target_type *cast = dynamic_cast<target_type *>(&to_cast);
if (!cast) throw "error: casting problem, unknown RTTI cast.";
return cast;
template <class target_type, class source_type>
const target_type *cast_or_throw(const source_type &to_cast, const target_type &ignored)
{
- if (!&ignored) {} // do nothing.
+// if (!&ignored) {} // do nothing.
const target_type *cast = dynamic_cast<const target_type *>(&to_cast);
if (!cast) throw "error: casting problem, unknown RTTI cast.";
return cast;
//! deletion with clearing of the pointer.
/*! this function simplifies the two step process of deleting a pointer and
-then clearing it to NIL. this makes debugging a bit easier since an access
-of NIL should always cause a fault, rather than looking like a possibly
+then clearing it to NULL_POINTER. this makes debugging a bit easier since an access
+of NULL_POINTER should always cause a fault, rather than looking like a possibly
valid object. */
template<class contents>
-void WHACK(contents * &ptr) { if (ptr) { delete ptr; ptr = NIL; } }
+void WHACK(contents * &ptr) { if (ptr) { delete ptr; ptr = NULL_POINTER; } }
//! Returns an object that is defined statically.
/*! Thus the returned object will never be recreated once this function