Update window.h
Add a Cpp20 Concept to constrain the Window Constructor parameter
This commit is contained in:
@@ -14,10 +14,16 @@ struct WindowCreateParams
|
||||
const char* name;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
concept IsWindow = requires(T t) {
|
||||
PumpMessages(t);
|
||||
ShouldClose(t);
|
||||
};
|
||||
|
||||
class Window
|
||||
{
|
||||
public:
|
||||
template<typename T>
|
||||
template<IsWindow T>
|
||||
Window(T t)
|
||||
: self{std::make_unique<model_t<T>>(std::move(t))}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user