mirror of https://github.com/Wilfred/difftastic/
101 lines
2.6 KiB
Plaintext
101 lines
2.6 KiB
Plaintext
================================================
|
|
template functions vs relational expressions
|
|
================================================
|
|
|
|
T1 a = b < c > d;
|
|
T2 e = f<T3>(g);
|
|
int a = std::get<0>(t);
|
|
|
|
---
|
|
|
|
(translation_unit
|
|
(declaration
|
|
(type_identifier)
|
|
(init_declarator
|
|
(identifier)
|
|
(binary_expression
|
|
(binary_expression (identifier) (identifier))
|
|
(identifier))))
|
|
(declaration
|
|
(type_identifier)
|
|
(init_declarator
|
|
(identifier)
|
|
(call_expression
|
|
(template_function (identifier) (template_argument_list
|
|
(type_descriptor (type_identifier))))
|
|
(argument_list (identifier)))))
|
|
(declaration
|
|
(primitive_type)
|
|
(init_declarator
|
|
(identifier)
|
|
(call_expression
|
|
(template_function
|
|
(scoped_identifier (namespace_identifier) (identifier))
|
|
(template_argument_list (number_literal)))
|
|
(argument_list (identifier))))))
|
|
|
|
=================================================
|
|
function declarations vs variable initializations
|
|
=================================================
|
|
|
|
// Function declarations
|
|
T1 a(T2 *b);
|
|
T3 c(T4 &d, T5 &&e);
|
|
|
|
// Variable declarations with initializers
|
|
T7 f(g.h);
|
|
T6 i{j};
|
|
|
|
---
|
|
|
|
(translation_unit
|
|
(comment)
|
|
(declaration
|
|
(type_identifier)
|
|
(function_declarator
|
|
(identifier)
|
|
(parameter_list (parameter_declaration (type_identifier) (pointer_declarator (identifier))))))
|
|
(declaration
|
|
(type_identifier)
|
|
(function_declarator
|
|
(identifier)
|
|
(parameter_list
|
|
(parameter_declaration (type_identifier) (reference_declarator (identifier)))
|
|
(parameter_declaration (type_identifier) (reference_declarator (identifier))))))
|
|
|
|
(comment)
|
|
(declaration
|
|
(type_identifier)
|
|
(init_declarator
|
|
(identifier)
|
|
(argument_list (field_expression (identifier) (field_identifier)))))
|
|
(declaration
|
|
(type_identifier)
|
|
(init_declarator
|
|
(identifier)
|
|
(initializer_list (identifier)))))
|
|
|
|
================================================
|
|
template classes vs relational expressions
|
|
================================================
|
|
|
|
int main() {
|
|
T1<T2> v1;
|
|
T1<T2> v2 = v3;
|
|
}
|
|
|
|
---
|
|
|
|
(translation_unit (function_definition
|
|
(primitive_type)
|
|
(function_declarator (identifier) (parameter_list))
|
|
(compound_statement
|
|
(declaration
|
|
(template_type (type_identifier)
|
|
(template_argument_list (type_descriptor (type_identifier))))
|
|
(identifier))
|
|
(declaration
|
|
(template_type (type_identifier)
|
|
(template_argument_list (type_descriptor (type_identifier))))
|
|
(init_declarator (identifier) (identifier))))))
|