Template function pointer as a template parameter

Question!

I define a set of function templates:

template < typename type >
void foo ( type object )
{
    //  foo the object
}

template < typename type >
void bar ( type object )
{
    //  bar the object
}

template < typename type >
void baz ( type object )
{
    //  baz the object
}

Now I want to define a function template which takes a pointer to any of the functions from the above.

    template < /* ??? */ , typename T , typename... TT >
    void for_each ( T parameter , TT... other parameters )
    {
       // process the first parameter using the function pointer defined by the first template parameter
       // recursice call to for_each
    }

What is the correct way to declare the first template parameter?

P.S. I do know that there is a workaround to wrap the first three functions each in a class and make them static. I just want to know if there is a straight way to solve the problem.

By : Kolyunya


Answers

template template arguments have to be classes.

#include 
By : galop1n


This video can help you solving your question :)
By: admin