简体   繁体   中英

Initializer list C++ in class diagram

I just study class diagram for a few days ago and now I meet a problem where the constructor has its initializer list, is there any way to show the initializer list in class diagram, with example would be good, thank you in advance.

A C++ inializer list is just the type of a parameter of a constructor, like any other.

In the class diagram, you'd therefore show the corresponding constructor (preceded with «create») as an operation with a parameter of this type.

If you want to highlight it, you could add in the diagram the initalizer_list as a separate UML template class and draw a dependency of the class or its constructor to this template. But this is not required, and could quickly lead to undreadable diagrams if many classes use this mechanism.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM