Is it possible to wrap a templated native C++ class with C++/CLI? For example,
template <class T>
class TemplateTest
{
public:
TemplateTest(const T& x) { mX = x; }
~TemplateTest(void);
T getValue() { return mX; }
private:
T mX;
};
The usual way is to hold a pointer to class TemplateTest however with a templated class I would have to know what type T is at compile time. How do people normally manage these kinds of scenarios?
There is no general strategy, other than pre-defining all such template specialisations you care about, and explicitly mapping each CLI generic to a custom wrapper for the template specialisation.