#include <iostream>
#include <memory>
struct Line{
void Draw(){
std::cout<<"draw line"<<std::endl;
}
};
struct Circle{
void Draw(){
std::cout<<"draw circle"<<std::endl;
}
};
struct Rectangle{
int Draw(){
std::cout<<"not draw"<<std::endl;
return 0;
}
void GetArea(){
}
};
template<typename T>
void Static_Test(T t){
t.Draw();
}
void Test(){
Line l;
Circle c;
Static_Test(l);
Static_Test(c);
Rectangle t;
Static_Test(t);
}
template<typename T>
concept DrawObj = requires(T t) {
{ t.Draw() }-> std::same_as<void>;
};
template<typename T>
requires DrawObj<T>
void Static_Check_Test(T t) {
t.Draw();
}
void Test1(){
Line l;
Circle c;
Static_Check_Test(l);
Static_Check_Test(c);
Rectangle t;
}
int main(){
Test();
Test1();
return 0;
}