Poarthur
Poarthur

Reputation: 53

Why that partial template specialization is allowed?

I've looked at a partial template specialization argument-list and stumbled upon such an example

template <typename>
class function;
template <typename ReturnValue, typename Args,typename Args2>
class function<ReturnValue(Args,Args2)>
{
    //smth
};

What exactly means ReturnValue(Args,Args2) (couse it's not a type as I know) and by what rules can I write similar things?

Thanks

Upvotes: 1

Views: 63

Answers (1)

couse it's not a type as I know

Actually, it is. ReturnValue(Args,Args2) is the type "function taking Args and Arg2 and returning ReturnValue". Take this example:

void foo(int, char);
typedef void FunctionType(int, char);

Here, FunctionType is indeed the type void(int, char), which is also the type of foo.

Upvotes: 4

Related Questions