Enlico
Enlico

Reputation: 28384

What does it mean that function parameter packs are always pack expansions, so their declared types must include at least one parameter pack?

In this snippet

template<typename... Types>
void f(Types ... args);

Types is the template parameter pack and args is a function parameter pack.

Concerning the two technical terms, C++ Templates - The Complete Guide 2nd Edition reads

Unlike template parameter packs, function parameter packs are always pack expansions, so their declared types must include at least one parameter pack.

What does that mean? What is the example of non-at least one, i.e. zero in the context of that sentence?

Upvotes: 1

Views: 66

Answers (1)

HolyBlackCat
HolyBlackCat

Reputation: 96012

It says that a function parameter pack can only be created using another parameter pack, rather than from scratch.

What is the example of non-at least one, i.e. zero in the context of that sentence?

E.g. int ...params is illegal, because it doesn't contain any existing packs.

Upvotes: 2

Related Questions