template void tvision_obj_from_magic(T *dest, SV *objref, int flags) { struct tvision_info* tinfo= tvision_info_from_magic(objref, flags); T typed= tinfo->tobj? dynamic_cast(tinfo->tobj) : NULL; if ((flags & OR_DIE) && !typed) croak("Wrong type of object"); *dest= typed; }