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;
|
const char* name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template< typename T >
|
||||||
|
concept IsWindow = requires(T t) {
|
||||||
|
PumpMessages(t);
|
||||||
|
ShouldClose(t);
|
||||||
|
};
|
||||||
|
|
||||||
class Window
|
class Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template<typename T>
|
template<IsWindow T>
|
||||||
Window(T t)
|
Window(T t)
|
||||||
: self{std::make_unique<model_t<T>>(std::move(t))}
|
: self{std::make_unique<model_t<T>>(std::move(t))}
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user