A C++ concept can be constructed by combining other concepts or a list of required expressions, with boolean operators.
When a class A inherits from B, there is only one relation (mostly resembles union). For a C++ concept, the relation to another concept can a be union, an intersection, and difference. Also the expression can contain sub-expressions, how to deal with that?
After digging around, I found this solution
@startuml
skinparam style strictuml
Hide empty members
interface scalar<T>
interface arithmetic<T>
interface complex<T>
scalar *-- arithmetic : <<T>>
scalar *-- complex : <<T>>
complex *-- arithmetic : <<typename T::value_type>>
(scalar,arithmetic) ... (scalar,complex) : {or}
interface complex {
T a
-- requires --
typename T::value_type
{method} {a.real()} -> same_as<typename T::value_type>
{method} {a.imag()} -> same_as<typename T::value_type>
}
@enduml
Which renders to
Does this picture say convey that
A scalar may be arithmetic (read: a non-complex number) or a complex number. A complex number must have a value type (which is arithmetic), and accessors for real and imaginary parts.
?