E2301 Cannot use templates in closure arguments -- use a typedef (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

When declaring a closure type, the arguments passed to that closure must be of a simple type. Templates are not accepted. To pass a reference to an object of template type to a closure, you must declare a typedef, which counts as a simple type name.

Example:

typedef my_class<int> mci;
typedef void (__closure * func) (const mci& object);