Added basic test case for sequence diagrams with class template specializations
This commit is contained in:
@@ -4,20 +4,41 @@ 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"; }
|
||||
T a1(T arg) { return arg; }
|
||||
T a2(T arg) { return arg + arg; }
|
||||
};
|
||||
|
||||
template <typename T> struct B {
|
||||
T b(T arg) { return a_.a_int(arg); }
|
||||
T b(T arg) { return a_.a1(arg); }
|
||||
A<T> a_;
|
||||
};
|
||||
|
||||
template <> struct B<std::string> {
|
||||
std::string b(std::string arg) { return a_.a_string(arg); }
|
||||
std::string b(std::string arg) { return a_.a2(arg); }
|
||||
A<std::string> a_;
|
||||
};
|
||||
|
||||
template <typename T> struct AA {
|
||||
void aa1(T t) { }
|
||||
void aa2(T t) { }
|
||||
};
|
||||
|
||||
|
||||
template <typename T, typename F> struct BB {
|
||||
void bb1(T t, F f) { aa_.aa1(t); }
|
||||
void bb2(T t, F f) { aa_.aa2(t); }
|
||||
|
||||
AA<T> aa_;
|
||||
};
|
||||
|
||||
template <typename T> struct BB<T, std::string> {
|
||||
void bb1(T t, std::string f) { aa_.aa2(t); }
|
||||
void bb2(T t, std::string f) { aa_.aa1(t); }
|
||||
|
||||
AA<T> aa_;
|
||||
};
|
||||
|
||||
|
||||
void tmain()
|
||||
{
|
||||
B<int> bint;
|
||||
@@ -25,6 +46,15 @@ void tmain()
|
||||
|
||||
bint.b(1);
|
||||
bstring.b("bstring");
|
||||
|
||||
BB<int, int> bbint;
|
||||
BB<int, std::string> bbstring;
|
||||
|
||||
bbint.bb1(1, 1);
|
||||
bbint.bb2(2, 2);
|
||||
|
||||
bbstring.bb1(1, "calling aa2");
|
||||
bbstring.bb2(1, "calling aa1");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user