tags:

views:

95

answers:

1

hello.

Is there 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 workaround by using extra class around template struct. I am wondering if it's possible to do so directly.

Thanks

+6  A: 

The proper syntax for template template-parameters is as follows

template < class > struct f {}; 

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

...     
function < f >()
AndreyT
I know I have seen this syntax before. now I actually know how to use it.spasibo
aaa
Wow! Never seen the template<class> without naming the class. Where can I read more on that?
sharptooth
@sharptooth: There's not much to read here. Just like with ordinary function parameters, if you are not using the template parameter you don't have to name it.
AndreyT