Does UML Class Diagram support expressing Concept?
Also, is there any other diagrams that expresses Concept?
Just in case of misunderstanding, I mean the "Concept" in C++ and generic programming.
After reading shortly Wikipedia explanation of C++ "concepts" it looks to me like tool with same goals as generic classes and type constraints in C#
If I understood it correctly then by following older Stack Overflow question Representing a C# Generic Method in a UML Class Diagram it turns out that you should check the http://www.uml-diagrams.org/template.html as already suggested by @Aleks
Basically I mean to model your interfaces and classes as you'd normally do it. Just use the templating annotation and you can also chart some type restrictions using a virtual dependency, inheritance associations between the formal parameters used in the template
Basically the question can be answered with an answer to the "base class" question : "does UML make any attempt to make it 1-to-1 fitting to C++?"
Answer is simply "no".
This is a very common misunderstanding, one can meet people looking for possibilities of expressing a pointer in UML or any other C++ specific things. You will unluckily not find it.
The misunderstanding is comes historically from the availability of C++ code generation engines which come with some UML modeling tools. All those code generation engines come with their own coding patterns to address the transition from model to code. Simply because there is no standard for the transition patterns itself.
UML comes from OMG and OMG has a generation patterns document for (Corba)IDL-to-C++ but none for UML-to-C++.
You can show in UML all structures used by concept - i.e., functions, algorithms, classes and so on. But not the concept itself, for it is an element creating syntax.
Also, you can't show in UML macros, preprocessor commands, etc.
All these things simply do not belong to model, but to the language/grammar/syntax. There are other tools for their support. Formal grammars, theories, etc. Yes, there are diagrams for it. Look for "formal grammar diagrams" in google and you'll see heaps of them.
来源:https://stackoverflow.com/questions/24378290/how-can-we-express-concept-in-uml-diagram