From 95d68cd5c9c51bac513eb8ff57ffff63995a80a2 Mon Sep 17 00:00:00 2001 From: Faumaray Date: Mon, 20 Oct 2025 01:23:29 +0300 Subject: [PATCH] enforce ctx in constructor Signed-off-by: Faumaray --- include/Mod/Mod.hpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/include/Mod/Mod.hpp b/include/Mod/Mod.hpp index b0d5940..a01f97c 100644 --- a/include/Mod/Mod.hpp +++ b/include/Mod/Mod.hpp @@ -13,39 +13,7 @@ namespace vl::mod { #define VL_MOD_SECTION __attribute__((used)) #endif -// --- Contract concepts (NV2 + C2 + lifecycle) --- - -// Must have T(const Context&) - template -concept HasCtorWithContext = - std::constructible_from; - -// Must provide compile-time identity (SV1) -template -concept HasStaticName = - requires { { T::Name() } -> std::same_as; }; - -template -concept HasStaticVersion = - requires { { T::Version() } -> std::same_as; }; - -// Must implement lifecycle -template -concept HasLifecycle = - requires(T& o) { - { o.onStart() } -> std::same_as; - { o.onStop() } -> std::same_as; - }; - -// --- CRTP base --- -// NOTE: constraints placed on the template parameter itself (prevents -// GCC from evaluating them before T is complete). -template - requires HasCtorWithContext && - HasStaticName && - HasStaticVersion && - HasLifecycle class Mod : public Base { private: static std::unique_ptr _vl_factory(const Context& ctx) { @@ -59,10 +27,6 @@ private: }; public: - // R2: runtime identity getters implemented here using NV2 statics - std::string_view name() const noexcept override { return T::Name(); } - std::string_view version() const noexcept override { return T::Version(); } - virtual ~Mod() = default; };