This is more a C++ general question rather than UAVCAN related. Coming from C language I am a bit new to some C++ features such as templates. However, I am trying to make a function template that needs a union tag to create a uavcan request as below. T and V typenames works, but how can I make the tag a template as well?
It doesn’t work because in a template context the compiler can’t know the kind of to; it doesn’t expect a template instantiation construct ahead. You have to tell the compiler that a template is coming by saying request.template to<TAG>().
In the future, when something isn’t working, please post what exactly the problem is and what error messages you’re seeing, otherwise it might be difficult to understand what’s happening.