# t00034 - Template metaprogramming type function test case ## Config ```yaml compilation_database_dir: .. output_directory: puml diagrams: t00034_class: type: class glob: - ../../tests/t00034/t00034.cc using_namespace: - clanguml::t00034 include: namespaces: - clanguml::t00034 plantuml: after: - "@A(R) --> @A(A) : +la" ``` ## Source code File t00034.cc ```cpp #include namespace clanguml { // // Based on https://github.com/facebook/folly/blob/master/folly/Unit.h // namespace t00034 { struct Void { constexpr bool operator==(const Void & /* unused */) const { return true; } constexpr bool operator!=(const Void & /* unused */) const { return false; } }; constexpr Void void_t{}; template struct lift_void { using type = T; }; template <> struct lift_void { using type = Void; }; // // TODO: This is a shortcoming of libclang which parses the type of lift_void_t // alias as unexposed, i.e. no actual reference to T can be inferred without // manually parsing the string 'typename lift_void::type' // For now, this test validates that the visitor does not crash, the reference // between R and A has to be provided in the configuration file // template using lift_void_t = typename lift_void::type; template struct drop_void { using type = T; }; template <> struct drop_void { using type = void; }; template using drop_void_t = typename drop_void::type; struct A { }; struct R { lift_void_t *la; lift_void_t *lv; }; } // namespace t00034 } // namespace clanguml ``` ## Generated UML diagrams ![t00034_class](./t00034_class.svg "Template metaprogramming type function test case")