Reputation: 217
I wish to know how std::function
determines the argument and parameters from the function type that you pass in.
Upvotes: 0
Views: 213
Reputation: 146968
It's a partial template specialization.
template<typename T> class function;
template<typename Ret> class function<Ret()> { ... };
template<typename Ret, typename Arg1> class function<Ret(Arg1)> { ... };
As you can see, this will get old quickly, but variadic templates will handle it in C++0x.
Upvotes: 6