From 4a529c6ea912bcba1b44bb5fffe12244bc1cd923 Mon Sep 17 00:00:00 2001 From: Faumaray Date: Mon, 20 Oct 2025 00:58:51 +0300 Subject: [PATCH] enforce ctx in constructor Signed-off-by: Faumaray --- include/Mod/Mod.hpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/include/Mod/Mod.hpp b/include/Mod/Mod.hpp index da432dd..f922e22 100644 --- a/include/Mod/Mod.hpp +++ b/include/Mod/Mod.hpp @@ -5,19 +5,9 @@ #include #include #include - -namespace vl::mod { - -#if defined(__ELF__) - #define VL_MOD_SECTION __attribute__((section("vlmods"), used)) -#else - #define VL_MOD_SECTION __attribute__((used)) -#endif - -// ---- Contract Concepts ---- template concept HasCtorWithContext = - requires(const Context& ctx) { + requires(const vl::mod::Context& ctx) { { T(ctx) }; }; @@ -38,7 +28,16 @@ concept HasLifecycle = requires(T obj) { { obj.onStart() } -> std::same_as; { obj.onStop() } -> std::same_as; - }; + };namespace vl::mod { + +#if defined(__ELF__) + #define VL_MOD_SECTION __attribute__((section("vlmods"), used)) +#else + #define VL_MOD_SECTION __attribute__((used)) +#endif + +// ---- Contract Concepts ---- + template < class T