# t20008 - Constexpr if sequence diagram test case ## Config ```yaml compilation_database_dir: .. output_directory: puml diagrams: t20008_sequence: type: sequence glob: - ../../tests/t20008/t20008.cc include: namespaces: - clanguml::t20008 using_namespace: - clanguml::t20008 start_from: - function: "clanguml::t20008::tmain()" ``` ## Source code File t20008.cc ```cpp #include #include namespace clanguml { namespace t20008 { template struct A { void a1(T arg) { } void a2(T arg) { } void a3(T arg) { } }; template struct B { A a; void b(T arg) { if constexpr (std::is_integral_v) { a.a1(arg); } else if constexpr (std::is_pointer_v) { a.a2(arg); } else { a.a3(arg); } } }; void tmain() { using namespace std::string_literals; B bint; B bcharp; B bstring; bint.b(1); bcharp.b("1"); bstring.b("1"s); } } } ``` ## Generated UML diagrams ![t20008_sequence](./t20008_sequence.svg "Constexpr if sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { "clang_uml_version": "0.3.4-45-gdec4b7b", "llvm_version": "Ubuntu clang version 15.0.6", "schema_version": 1 }, "name": "t20008_sequence", "participants": [ { "id": "1180776240543224244", "name": "clanguml::t20008::tmain()", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 30 }, "type": "function" }, { "id": "1906510289157013670", "name": "clanguml::t20008::B", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 13 }, "type": "class" }, { "id": "1376149084762923197", "name": "clanguml::t20008::A", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 7 }, "type": "class" }, { "id": "867098551202196741", "name": "clanguml::t20008::B", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 13 }, "type": "class" }, { "id": "144833378017373200", "name": "clanguml::t20008::A", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 7 }, "type": "class" }, { "id": "927702553742507923", "name": "clanguml::t20008::B", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 13 }, "type": "class" }, { "id": "390605614583363778", "name": "clanguml::t20008::A", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 7 }, "type": "class" } ], "sequences": [ { "messages": [ { "from": { "activity_id": "1180776240543224244", "activity_name": "clanguml::t20008::tmain()", "participant_id": "1180776240543224244", "participant_name": "clanguml::t20008::tmain()" }, "name": "b(int)", "return_type": "void", "scope": "normal", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 38 }, "to": { "activity_id": "379850145437051189", "activity_name": "clanguml::t20008::B::b(int)", "participant_id": "1906510289157013670" }, "type": "message" }, { "from": { "activity_id": "379850145437051189", "activity_name": "clanguml::t20008::B::b(int)", "participant_id": "1906510289157013670" }, "name": "a1(int)", "return_type": "void", "scope": "normal", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 19 }, "to": { "activity_id": "2066363630174644719", "activity_name": "clanguml::t20008::A::a1(int)", "participant_id": "1376149084762923197" }, "type": "message" }, { "from": { "activity_id": "1180776240543224244", "activity_name": "clanguml::t20008::tmain()", "participant_id": "1180776240543224244", "participant_name": "clanguml::t20008::tmain()" }, "name": "b(const char *)", "return_type": "void", "scope": "normal", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 39 }, "to": { "activity_id": "1347162523481637780", "activity_name": "clanguml::t20008::B::b(const char *)", "participant_id": "867098551202196741" }, "type": "message" }, { "from": { "activity_id": "1347162523481637780", "activity_name": "clanguml::t20008::B::b(const char *)", "participant_id": "867098551202196741" }, "name": "a2(const char *)", "return_type": "void", "scope": "normal", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 22 }, "to": { "activity_id": "718650834962275580", "activity_name": "clanguml::t20008::A::a2(const char *)", "participant_id": "144833378017373200" }, "type": "message" }, { "from": { "activity_id": "1180776240543224244", "activity_name": "clanguml::t20008::tmain()", "participant_id": "1180776240543224244", "participant_name": "clanguml::t20008::tmain()" }, "name": "b(std::string)", "return_type": "void", "scope": "normal", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 40 }, "to": { "activity_id": "1286410946666951254", "activity_name": "clanguml::t20008::B::b(std::string)", "participant_id": "927702553742507923" }, "type": "message" }, { "from": { "activity_id": "1286410946666951254", "activity_name": "clanguml::t20008::B::b(std::string)", "participant_id": "927702553742507923" }, "name": "a3(std::string)", "return_type": "void", "scope": "normal", "source_location": { "file": "../../tests/t20008/t20008.cc", "line": 25 }, "to": { "activity_id": "1404594247101138737", "activity_name": "clanguml::t20008::A::a3(std::string)", "participant_id": "390605614583363778" }, "type": "message" } ], "start_from": { "id": 1180776240543224244, "location": "clanguml::t20008::tmain()" } } ], "using_namespace": "clanguml::t20008" } ```