我该如何在 UML 类图中绘制 C++ 概念?
具体而言,我有以下代码:
template<typename T>
concept Printable = requires(T a, std::ostream &where) {
{ where << a };
};
template<typename T>
concept Identifiable = requires(T a) {
{ a.getId() } -> std::convertible_to<std::string>;
};
template<typename T>
concept Listable = Identifiable<T> && Printable<T>;
接着是一个类:
template<Listable T>
class Liste {
...
void add(T *data);
...
}
如果这是一个普通的模板,我会在类角落里放置一个方形T
。但概念应该怎么办呢?