What is the precedence of the meta-operator ...
whose job is to unpack template type parameter packs? I imagine it's pretty low, but how low is it? The C++ standard says:
The precedence of operators is not directly specified, but it can be derived from the syntax.
Anyone up for the challenge? Of course, ...
does not appear in C++03 operator precedence tables.
Okay, if ...
is not an operator, what exactly determines that std::forward<Args>(args)...
applies to the the entire sequence std::forward<Args>(args)
and not just (args)
, for example?
It doesn't seem to be an operator. From N3092 (sorry I don't have a more recent draft handy)
[14.5.3] 4/ A pack expansion is a sequence of tokens that names one or more parameter packs, followed by an ellipsis. The sequence of tokens is called the pattern of the expansion; its syntax depends on the context in which the expansion occurs. Pack expansions can occur in the following contexts:
- In an initializer-list (8.5); the pattern is an initializer-clause.
- In a base-specifier-list (10); the pattern is a base-specifier.
- In a mem-initializer-list (12.6.2); the pattern is a mem-initializer.
- In a template-argument-list (14.3); the pattern is a template-argument.
- In a dynamic-exception-specification (15.4); the pattern is a type-id.
- In an attribute-list (7.6.1); the pattern is an attribute.
In a capture-list (5.1.2); the pattern is a capture. [Example:
template<class ... Types> void f(Types ... rest); template<class ... Types> void g(Types ... rest) { f(&rest ...); // “&rest ...” is a pack expansion; “&rest” is its pattern }
— end example]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With