Skip to content

Instantly share code, notes, and snippets.

@jerstlouis
Created July 1, 2020 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerstlouis/a1fcc454baf209bb5b53d48d09839bc5 to your computer and use it in GitHub Desktop.
Save jerstlouis/a1fcc454baf209bb5b53d48d09839bc5 to your computer and use it in GitHub Desktop.
template<typename TPT> inline CPPClass & ensureTemplatized(CPPClass & _class, const char * name)
{
if(!_class.impl || !_class.impl->templateClass)
{
char type[1024];
strcpy(type, "CPP");
strcat(type, name);
strcat(type, "<");
{
const char * t1 = TypeName<TPT>::get();
if(isConst<TPT>()) strcat(type, "const ");
strcat(type, t1);
}
strcat(type, ">");
// printf("Instantiating %s\n", type);
_class.impl = (XClass *)eC_findClass(__thisModule, type);
if(_class.impl) _class.impl->bindingsClass = &_class;
}
return _class;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment