keywords: C++ Template, advanced examples, tutorials

Issues

error c3856 ‘id’ symbol is not a class template
template <typename T>
struct TObjectPtr
{
};

template <typename T>
struct TContainerElementTypeCompatibility<TObjectPtr<T>>
{
    typedef T* ReinterpretType;
};

Compilation error:

a template argument list is not allowed in a declaration of a primary template

or

error c3856 'TContainerElementTypeCompatibility' symbol is not a class template

Caused by:
The forward declaration missed.

Solution:

template <typename T>
struct TObjectPtr
{
};

template <typename T>
struct TContainerElementTypeCompatibility
{
};

template <typename T>
struct TContainerElementTypeCompatibility<TObjectPtr<T>>
{
    typedef T* ReinterpretType;
};

class A
{
};

int main(char** args, int argn)
{
    TContainerElementTypeCompatibility<TObjectPtr<A>> aaa;
}
References

What are some uses of template template parameters?
https://stackoverflow.com/a/213811/1645289

Double-templated function instantiation fails
https://stackoverflow.com/a/19959793/1645289

How to forward declare a C++ template class?
https://stackoverflow.com/a/13848492/1645289


Better to light a candle than to curse the darkness. -Chinese Proverbs