#include <iostream>
#include <functional>

class Toto
{
public:
    int test(float f) { std::cout << "Toto::test " << f << std::endl; return 0; }
} toto;

int test(float f)
{
    std::cout << "test " << f << std::endl;
    return 0;
}

namespace details
{
	template <typename T, T t>
	struct func_impl
	{
	    void operator () () const { t(4.0f); }
	};

	template <typename T, int (T::*method)(float)>
	struct func_impl<int (T::*)(float), method>
	{
	    void operator () () const { (toto.*method)(5.0f); }
	};

	
}


template <typename T, T t>
void func()
{
    details::func_impl<T, t>{}();
}

int main(int, char**)
{
    func<int(*)(float), &test>();
    func<int (Toto::*)(float), &Toto::test>();
}