#pragma define

C++ only


The #pragma define directive forces the definition of a template class without actually defining an object of the class. This pragma is only provided for backward compatibility purposes.


Read syntax diagramSkip visual syntax diagram>>-#--pragma--define--(--template_classname--)-----------------><

where the template_classname is the name of the template to be defined.


A user can explicitly instantiate a class, function or member template specialization by using a construct of the form:

template declaration

For example:

#pragma define(Array<char>)

is equivalent to:

template class Array<char>;

This pragma must be defined in namespace scope (i.e. it cannot be enclosed inside a function/class body). It is used when organizing your program for the efficient or automatic generation of template functions.

Related information