627 lines
15 KiB
Markdown
627 lines
15 KiB
Markdown
# t00012 - Advanced template instantiations
|
|
## Config
|
|
```yaml
|
|
diagrams:
|
|
t00012_class:
|
|
type: class
|
|
glob:
|
|
- t00012.cc
|
|
using_namespace: clanguml::t00012
|
|
include:
|
|
namespaces:
|
|
- clanguml::t00012
|
|
plantuml:
|
|
after:
|
|
- 'note right of @A(C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3>) : Long template annotation'
|
|
|
|
```
|
|
## Source code
|
|
File `tests/t00012/t00012.cc`
|
|
```cpp
|
|
#include <algorithm>
|
|
#include <array>
|
|
#include <map>
|
|
#include <string>
|
|
#include <variant>
|
|
#include <vector>
|
|
|
|
namespace clanguml {
|
|
namespace t00012 {
|
|
|
|
template <typename T, typename... Ts> class A {
|
|
T value;
|
|
std::variant<Ts...> values;
|
|
};
|
|
|
|
template <int... Is> class B {
|
|
std::array<int, sizeof...(Is)> ints;
|
|
};
|
|
|
|
template <typename T, int... Is> class C {
|
|
std::array<T, sizeof...(Is)> ints;
|
|
};
|
|
|
|
class R {
|
|
A<int, std::string, float> a1;
|
|
A<int, std::string, bool> a2;
|
|
|
|
B<3, 2, 1> b1;
|
|
B<1, 1, 1, 1> b2;
|
|
|
|
C<std::map<int, std::vector<std::vector<std::vector<std::string>>>>, 3, 3,
|
|
3>
|
|
c1;
|
|
};
|
|
} // namespace t00012
|
|
} // namespace clanguml
|
|
|
|
```
|
|
## Generated PlantUML diagrams
|
|

|
|
## Generated Mermaid diagrams
|
|

|
|
## Generated JSON models
|
|
```json
|
|
{
|
|
"diagram_type": "class",
|
|
"elements": [
|
|
{
|
|
"bases": [],
|
|
"display_name": "A<T,Ts...>",
|
|
"id": "14186399120185058260",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "value",
|
|
"source_location": {
|
|
"column": 7,
|
|
"file": "t00012.cc",
|
|
"line": 12,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"type": "T"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "values",
|
|
"source_location": {
|
|
"column": 25,
|
|
"file": "t00012.cc",
|
|
"line": 13,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"type": "std::variant<Ts...>"
|
|
}
|
|
],
|
|
"methods": [],
|
|
"name": "A",
|
|
"namespace": "clanguml::t00012",
|
|
"source_location": {
|
|
"column": 45,
|
|
"file": "t00012.cc",
|
|
"line": 11,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "template_type",
|
|
"name": "T",
|
|
"template_parameters": []
|
|
},
|
|
{
|
|
"is_variadic": true,
|
|
"kind": "template_type",
|
|
"name": "Ts...",
|
|
"template_parameters": []
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "B<int... Is>",
|
|
"id": "16489368620538237973",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "ints",
|
|
"source_location": {
|
|
"column": 36,
|
|
"file": "t00012.cc",
|
|
"line": 17,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"type": "std::array<int,sizeof...(Is)>"
|
|
}
|
|
],
|
|
"methods": [],
|
|
"name": "B",
|
|
"namespace": "clanguml::t00012",
|
|
"source_location": {
|
|
"column": 28,
|
|
"file": "t00012.cc",
|
|
"line": 16,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": true,
|
|
"kind": "non_type_template",
|
|
"name": "Is",
|
|
"template_parameters": [],
|
|
"type": "int..."
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "C<T,int... Is>",
|
|
"id": "5022476627261205034",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "ints",
|
|
"source_location": {
|
|
"column": 34,
|
|
"file": "t00012.cc",
|
|
"line": 21,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"type": "std::array<T,sizeof...(Is)>"
|
|
}
|
|
],
|
|
"methods": [],
|
|
"name": "C",
|
|
"namespace": "clanguml::t00012",
|
|
"source_location": {
|
|
"column": 40,
|
|
"file": "t00012.cc",
|
|
"line": 20,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "template_type",
|
|
"name": "T",
|
|
"template_parameters": []
|
|
},
|
|
{
|
|
"is_variadic": true,
|
|
"kind": "non_type_template",
|
|
"name": "Is",
|
|
"template_parameters": [],
|
|
"type": "int..."
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "A<int,std::string,float>",
|
|
"id": "2295779191536043659",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [],
|
|
"methods": [],
|
|
"name": "A",
|
|
"namespace": "clanguml::t00012",
|
|
"source_location": {
|
|
"column": 45,
|
|
"file": "t00012.cc",
|
|
"line": 11,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "int"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "std::string"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "float"
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "A<int,std::string,bool>",
|
|
"id": "2395729448786407708",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [],
|
|
"methods": [],
|
|
"name": "A",
|
|
"namespace": "clanguml::t00012",
|
|
"source_location": {
|
|
"column": 45,
|
|
"file": "t00012.cc",
|
|
"line": 11,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "int"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "std::string"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "bool"
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "B<3,2,1>",
|
|
"id": "3912506223772908750",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [],
|
|
"methods": [],
|
|
"name": "B",
|
|
"namespace": "clanguml::t00012",
|
|
"source_location": {
|
|
"column": 28,
|
|
"file": "t00012.cc",
|
|
"line": 16,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "3"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "2"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "1"
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "B<1,1,1,1>",
|
|
"id": "113858899865604792",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [],
|
|
"methods": [],
|
|
"name": "B",
|
|
"namespace": "clanguml::t00012",
|
|
"source_location": {
|
|
"column": 28,
|
|
"file": "t00012.cc",
|
|
"line": 16,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "1"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "1"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "1"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "1"
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3>",
|
|
"id": "11825915317057918032",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": true,
|
|
"is_union": false,
|
|
"members": [],
|
|
"methods": [],
|
|
"name": "C",
|
|
"namespace": "clanguml::t00012",
|
|
"source_location": {
|
|
"column": 40,
|
|
"file": "t00012.cc",
|
|
"line": 20,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "int"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "std::string"
|
|
}
|
|
],
|
|
"type": "std::vector"
|
|
}
|
|
],
|
|
"type": "std::vector"
|
|
}
|
|
],
|
|
"type": "std::vector"
|
|
}
|
|
],
|
|
"type": "std::map"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "3"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "3"
|
|
},
|
|
{
|
|
"is_variadic": false,
|
|
"kind": "argument",
|
|
"template_parameters": [],
|
|
"type": "3"
|
|
}
|
|
],
|
|
"type": "class"
|
|
},
|
|
{
|
|
"bases": [],
|
|
"display_name": "R",
|
|
"id": "4474107085863083753",
|
|
"is_abstract": false,
|
|
"is_nested": false,
|
|
"is_struct": false,
|
|
"is_template": false,
|
|
"is_union": false,
|
|
"members": [
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "a1",
|
|
"source_location": {
|
|
"column": 32,
|
|
"file": "t00012.cc",
|
|
"line": 25,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"type": "A<int,std::string,float>"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "a2",
|
|
"source_location": {
|
|
"column": 31,
|
|
"file": "t00012.cc",
|
|
"line": 26,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"type": "A<int,std::string,bool>"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "b1",
|
|
"source_location": {
|
|
"column": 16,
|
|
"file": "t00012.cc",
|
|
"line": 28,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"type": "B<3,2,1>"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "b2",
|
|
"source_location": {
|
|
"column": 19,
|
|
"file": "t00012.cc",
|
|
"line": 29,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"type": "B<1,1,1,1>"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"is_static": false,
|
|
"name": "c1",
|
|
"source_location": {
|
|
"column": 9,
|
|
"file": "t00012.cc",
|
|
"line": 33,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"type": "C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3>"
|
|
}
|
|
],
|
|
"methods": [],
|
|
"name": "R",
|
|
"namespace": "clanguml::t00012",
|
|
"source_location": {
|
|
"column": 7,
|
|
"file": "t00012.cc",
|
|
"line": 24,
|
|
"translation_unit": "t00012.cc"
|
|
},
|
|
"template_parameters": [],
|
|
"type": "class"
|
|
}
|
|
],
|
|
"name": "t00012_class",
|
|
"package_type": "namespace",
|
|
"relationships": [
|
|
{
|
|
"access": "public",
|
|
"destination": "14186399120185058260",
|
|
"source": "2295779191536043659",
|
|
"type": "instantiation"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "14186399120185058260",
|
|
"source": "2395729448786407708",
|
|
"type": "instantiation"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "16489368620538237973",
|
|
"source": "3912506223772908750",
|
|
"type": "instantiation"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "16489368620538237973",
|
|
"source": "113858899865604792",
|
|
"type": "instantiation"
|
|
},
|
|
{
|
|
"access": "public",
|
|
"destination": "5022476627261205034",
|
|
"source": "11825915317057918032",
|
|
"type": "instantiation"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"destination": "2295779191536043659",
|
|
"label": "a1",
|
|
"source": "4474107085863083753",
|
|
"type": "aggregation"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"destination": "2395729448786407708",
|
|
"label": "a2",
|
|
"source": "4474107085863083753",
|
|
"type": "aggregation"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"destination": "3912506223772908750",
|
|
"label": "b1",
|
|
"source": "4474107085863083753",
|
|
"type": "aggregation"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"destination": "113858899865604792",
|
|
"label": "b2",
|
|
"source": "4474107085863083753",
|
|
"type": "aggregation"
|
|
},
|
|
{
|
|
"access": "private",
|
|
"destination": "11825915317057918032",
|
|
"label": "c1",
|
|
"source": "4474107085863083753",
|
|
"type": "aggregation"
|
|
}
|
|
],
|
|
"using_namespace": "clanguml::t00012"
|
|
}
|
|
```
|