#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <iostream>
void function0(int vParam0, int vParam1)
{
std::cout << "function0:" << vParam0 << std::ends << vParam1 << std::endl;
}
void function1(std::string vParam0, float vParam1)
{
std::cout << "function1:" << vParam0 << std::ends << vParam1 << std::endl;
}
template <typename FuncAddress, typename P0, typename P1>
void excute(FuncAddress vFuncAddress, P0 vParam0, P1 vParam1)
{
typedef boost::function<void(P0, P1)> m_Functor;
m_Functor functor;
functor = boost::bind(vFuncAddress, _1, _2);
functor(vParam0, vParam1);
}
int main(int argc, char **argv)
{
excute(&function0, 2, 1);
std::string Str("hello world");
excute(&function1, Str, 11.0f);
return 0;
}
#include <boost/bind.hpp>
#include <iostream>
void function0(int vParam0, int vParam1)
{
std::cout << "function0:" << vParam0 << std::ends << vParam1 << std::endl;
}
void function1(std::string vParam0, float vParam1)
{
std::cout << "function1:" << vParam0 << std::ends << vParam1 << std::endl;
}
template <typename FuncAddress, typename P0, typename P1>
void excute(FuncAddress vFuncAddress, P0 vParam0, P1 vParam1)
{
typedef boost::function<void(P0, P1)> m_Functor;
m_Functor functor;
functor = boost::bind(vFuncAddress, _1, _2);
functor(vParam0, vParam1);
}
int main(int argc, char **argv)
{
excute(&function0, 2, 1);
std::string Str("hello world");
excute(&function1, Str, 11.0f);
return 0;
}