enforce ctx in constructor
Signed-off-by: Faumaray <faumaray@gmail.com>
This commit is contained in:
1 file changed
+11
-12
+11
-12
@@ -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
|
||||||
|
|||||||
Reference in new issue
Block a user