DmitryM
DmitryM

Reputation: 217

How std:: tr1:: function gets the parameters of the signature features and specializes the class*

I wish to know how std::function determines the argument and parameters from the function type that you pass in.

Upvotes: 0

Views: 213

Answers (1)

Puppy
Puppy

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

Related Questions