enforce ctx in constructor

Signed-off-by: Faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2025-10-20 00:58:51 +03:00
1 parent 8864f864f2
commit 4a529c6ea9
1 file changed
+11 -12
+11 -12
View File
@@ -5,19 +5,9 @@
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
#include <typeinfo> #include <typeinfo>
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> template<class T>
concept HasCtorWithContext = concept HasCtorWithContext =
requires(const Context& ctx) { requires(const vl::mod::Context& ctx) {
{ T(ctx) }; { T(ctx) };
}; };
@@ -38,7 +28,16 @@ concept HasLifecycle =
requires(T obj) { requires(T obj) {
{ obj.onStart() } -> std::same_as<void>; { obj.onStart() } -> std::same_as<void>;
{ obj.onStop() } -> std::same_as<void>; { obj.onStop() } -> std::same_as<void>;
}; };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 < template <
class T class T