Added to release 20, with appropriate changes to Match() and Get():
template<typename T,bool ExceptionOnError>
T * GetInstance(HSQUIRRELVM v,SQInteger idx) {
SQUserPointer up=0;
sq_getinstanceup(v,idx,&up,ClassType<T>::type());
if (ExceptionOnError) { // This code block should be compiled out when ExceptionOnError is false. In any case, the compiler should not generate a test condition (include or exclude the enclosed code block).
if (!up) throw SquirrelError(_T("GetInstance: Invalid argument type"));
} // if
return (T *)up;
} // GetInstance
http://www.brightland.com/sq/SQUIRREL2_1_0_sqplus_20.zip