dimanche 8 septembre 2019

Partial template specialization, using a templatized type

Given the generic function foo:

template<typename T> void foo(T a) { a(); }

I'd like to specialize this function for a type Bar, however, Bar itself has several template arguments itself. I was trying to specialize foo() as follows:

template<typename... Args> void foo<Bar<Args...> >(Bar<Args...> a) { a(42); }

However, this does not quite work. Could someone please help me out? Thanks

Aucun commentaire:

Enregistrer un commentaire