Files
clang-uml/docs/test_cases/t20006.md
2022-11-23 00:09:00 +01:00

55 lines
1.0 KiB
Markdown

# t20006 - Class template specialization basic sequence diagram
## Config
```yaml
compilation_database_dir: ..
output_directory: puml
diagrams:
t20006_sequence:
type: sequence
glob:
- ../../tests/t20006/t20006.cc
include:
namespaces:
- clanguml::t20006
using_namespace:
- clanguml::t20006
start_from:
- function: "clanguml::t20006::tmain()"
```
## Source code
File t20006.cc
```cpp
#include <string>
namespace clanguml {
namespace t20006 {
template <typename T> struct A {
T a_int(T arg) { return arg + 1; }
T a_string(T arg) { return arg + "_string"; }
};
template <typename T> struct B {
T b(T arg) { return a_.a_int(arg); }
A<T> a_;
};
template <> struct B<std::string> {
std::string b(std::string arg) { return a_.a_string(arg); }
A<std::string> a_;
};
void tmain()
{
B<int> bint;
B<std::string> bstring;
bint.b(1);
bstring.b("bstring");
}
}
}
```
## Generated UML diagrams
![t20006_sequence](./t20006_sequence.svg "Class template specialization basic sequence diagram")