struct f {}; template < class F > void funct...">

C ++ template argument "delayed"

Is there a direct way to do the following:

template < class >
struct f {};

template < class F >
void function() {
    F<int>();  //for example
    // ? F template <int>();
}

function < f >();

I have a workaround using an extra class around the struct template. I am wondering if it is possible to do this directly.

thank

+3
source share
1 answer

The correct template syntax is as follows

template < class > struct f {}; 

template < template <class> class F > 
void function() { 
    F<int>();  //for example 
} 

...     
function < f >()
+7
source

Source: https://habr.com/ru/post/1743112/


All Articles