Search code examples
c++umltypedef

Complex typedef in UML


I would like to know how I can represent complex typedef like the following in UML:

class Foo {
protected:
   typedef std::pair<uint64_t, Bar> BarPair;
   typedef std::set<BarPair> BarPairSet;

   std::map<uint32_t, BarPairSet> m_indexedBarPairSet
};

Bar is not part of Foo.


Solution

  • There is no direct way to represent your typedefs, of course it is possible to have for instance the class BarPair with a dependency to the template class pair but there is no standard way to support the binding.

    In case it is not for instance typedef std::pair BarPair but BarPair : public std::pair {} we have

    enter image description here

    So what about to extend UML with the stereotype typedef to have something like that :

    enter image description here

    or to stereotype the realization with typedef-bind and to use the stereotype typedef for BarPair and BarPairSet

    enter image description here