Cpp.ParameterPackExpansion Class
Namespace: Cpp
Superclasses: AstNodeProperties
Represents the parameter_pack_expansion nodes in the syntax tree of your code
Since R2026a
Description
The PQL class Cpp.ParameterPackExpansion represents the node parameter_pack_expansion in the syntax tree of your code.
template<typename... Args>
void foo(Args&&... args) {
bar(args...);
}The template parameter Args... and the function parameter args... in the example produce parameter_pack_expansion nodes that correspond to Cpp.ParameterPackExpansion.
Predicates
| Type | Raisable | Printable |
|---|---|---|
ParameterPackExpansion
| Yes | No |
This class defines these predicates that act on the objects of this class. In addition, objects of this class can access the predicates defined by the base class AstNodeProperties. An object of this class is an object of AstNodeProperties class.
| Predicates | Description | Example |
|---|---|---|
is(required ParameterPackExpansion &ppe)
| Matches a parameter_pack_expansion node and binds it to
ppe for further queries or reporting. Use it to directly find
expansions like T... or args.... | This PQL defect checks for any
defect defectIs =
when
Cpp.ParameterPackExpansion.is(&ppe)
and ppe.nodeText(&txt)
raise "ParameterPackExpansion.is matched: \"{txt}\""
on ppeIn this C++ code, the defect finds template or
function parameter pack expansions such as
template<typename... Args>
void foo(Args&&... args) {
bar(args...);
} |
cast(Cpp.Node.Node node, required ParameterPackExpansion
&cast)
| Checks whether an arbitrary Node is a
parameter_pack_expansion and if so converts and binds it to
cast for ParameterPackExpansion-specific
queries. | This PQL defect checks nodes discovered generically and casts them to
defect defectCast =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.ParameterPackExpansion.cast(node, &ppe)
and ppe.nodeText(&txt)
raise "ParameterPackExpansion.cast matched: \"{txt}\""
on ppeIn this C++ code, the defect finds
template<typename... Args>
void foo(Args&&... args) {
bar(args...);
} |
isa(Cpp.Node.Node node)
| Tests whether the given Node is a
parameter_pack_expansion without binding it. Use it for boolean
checks or negation. | This PQL defect checks whether a generic node is a
defect defectIsa =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.ParameterPackExpansion.isa(node)
raise "Node is a ParameterPackExpansion"
on nodeIn this C++ code, the defect verifies that
tokens like
template<typename... Args>
void foo(Args&&... args) {
bar(args...);
} |
pattern(ParameterPackExpansion self, Cpp.Node.Node &child)
| Matches the internal pattern part of a
parameter_pack_expansion and binds that inner node to
child such as the args in
args.... | This PQL defect checks for the inner pattern node inside a
defect defectPattern =
when
Cpp.ParameterPackExpansion.is(&ppe)
and ppe.pattern(&pat)
and pat.nodeText(&txt)
raise "ParameterPackExpansion.pattern matched: \"{txt}\""
on ppeIn this C++ code, the defect finds the
identifier
template<typename... Args>
void foo(Args&&... args) {
bar(args...);
} |
getEnclosingParameterPackExpansion(Cpp.Node.Node child, required
ParameterPackExpansion &parent)
| Finds the nearest ancestor parameter_pack_expansion that
encloses child and binds it to parent. Use it
to locate the expansion that contains a given token. | This PQL defect checks for nodes that are inside a
defect defectGetEnclosing =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.ParameterPackExpansion.getEnclosingParameterPackExpansion(node, &ppe)
and ppe.nodeText(&txt)
raise "Enclosing ParameterPackExpansion: \"{txt}\""
on ppeIn this C++ code, the defect takes a child like
the identifier
template<typename... Args>
void foo(Args&&... args) {
bar(args...);
} |
isEnclosedInParameterPackExpansion(Cpp.Node.Node child)
| Returns true if child has a
parameter_pack_expansion ancestor somewhere above it. Use it to
detect elements that are part of an expansion. | This PQL defect checks whether a given node is contained inside any
defect defectIsEnclosed =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.ParameterPackExpansion.isEnclosedInParameterPackExpansion(node)
raise "Node is enclosed in a ParameterPackExpansion"
on nodeIn this C++ code, the defect identifies tokens
such as
template<typename... Args>
void foo(Args&&... args) {
bar(args...);
} |
Version History
Introduced in R2026a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)