diff --git a/include/Mixin/CallbackInfo.hpp b/include/Mixin/CallbackInfo.hpp new file mode 100644 index 0000000..e9e6e2d --- /dev/null +++ b/include/Mixin/CallbackInfo.hpp @@ -0,0 +1,36 @@ +#pragma once +#include +#include + +namespace vl::mixin { +template +struct CallbackInfoReturnable; +// Base callback info: allows cancellation of original behavior. +struct CallbackInfo { + void cancel() noexcept { cancelled_ = true; } + bool isCancelled() const noexcept { return cancelled_; } +private: + bool cancelled_ = false; + template + friend class CallbackInfoReturnable; +}; + +// Returnable variant: holds an optional return value. +template +struct CallbackInfoReturnable : CallbackInfo { + template + void setReturnValue(T&& v) { + value_ = static_cast(std::forward(v)); + this->cancel(); // setting a value implies skipping original unless user calls uncancel() + } + bool hasReturnValue() const noexcept { return value_.has_value(); } + const Ret& getReturnValue() const { return *value_; } + Ret& getReturnValue() { return *value_; } + void clearReturnValue() { value_.reset(); } + void uncancel() { if (!value_) /*no explicit value*/ cancelled_ = false; } +private: + using CallbackInfo::cancelled_; + std::optional value_; +}; + +} // namespace vl::mixin diff --git a/include/Mixin/CallbackInfoExtended.hpp b/include/Mixin/CallbackInfoExtended.hpp new file mode 100644 index 0000000..13640b9 --- /dev/null +++ b/include/Mixin/CallbackInfoExtended.hpp @@ -0,0 +1,32 @@ +#pragma once +#include + +namespace vl::mixin { + +// For INVOKE_AFTER: exposes access to callee result. +template +struct CallbackInfoInvokeAfter : CallbackInfoReturnable { + using Base = CallbackInfoReturnable; + Ret& originalReturn() noexcept { return orig_; } + const Ret& originalReturn() const noexcept { return orig_; } + + void setOriginalReturn(const Ret& v) noexcept { orig_ = v; } + +private: + Ret orig_{}; +}; + +// For FIELD_GET / FIELD_PUT: +// GET -> exposes current field value, PUT -> exposes incoming value. +template +struct CallbackInfoField : CallbackInfoReturnable { + using Base = CallbackInfoReturnable; + // For GET before/after: + void setFieldValue(const T& v) { field_ = v; } + const T& fieldValue() const { return field_; } + +private: + T field_{}; +}; + +} // namespace vl::mixin diff --git a/include/Mixin/CallbackRegistry.hpp b/include/Mixin/CallbackRegistry.hpp new file mode 100644 index 0000000..a0ed428 --- /dev/null +++ b/include/Mixin/CallbackRegistry.hpp @@ -0,0 +1,33 @@ +#pragma once +#include +#include +#include +#include +#include +#include "Types.hpp" + +namespace vl::mixin { + +class CallbackRegistry { +public: + static CallbackId add(ErasedCallback cb) { + static CallbackId next = 1; + std::unique_lock lk(mu_); + auto id = next++; + table_.emplace(id, std::move(cb)); + return id; + } + + static ErasedCallback* get(CallbackId id) { + std::shared_lock lk(mu_); + auto it = table_.find(id); + if (it == table_.end()) return nullptr; + return &it->second; + } + +private: + static inline std::shared_mutex mu_; + static inline std::unordered_map table_; +}; + +} // namespace vl::mixin diff --git a/include/Mixin/Macros.hpp b/include/Mixin/Macros.hpp new file mode 100644 index 0000000..8ca3ec4 --- /dev/null +++ b/include/Mixin/Macros.hpp @@ -0,0 +1,163 @@ +#pragma once +#include +#include +#include +#include + + +#define MIXIN_INJECT(MethodPtr, AT_ENUM) \ + static_assert(::vl::reflect::is_valid_method(), \ + "MIXIN_INJECT: invalid method pointer — missing or wrong reflection"); \ + struct _VL_INJECT_REG_##MethodPtr { \ + _VL_INJECT_REG_##MethodPtr() { \ + using _Target = typename std::remove_pointer_t; \ + ::vl::mixin::InjectionSpec spec{ \ + ::vl::reflect::method_owner(), \ + ::vl::reflect::method_name(), \ + ::vl::reflect::method_desc(), \ + AT_ENUM, ::vl::mixin::Side::Before, \ + ::vl::mixin::CallbackRegistry::add(_vl_make_callback_MethodPtr())\ + }; \ + ::vl::mixin::Mixin<_Target>::add(spec); \ + } \ + } _vl_inject_reg_##MethodPtr; \ + static ::vl::mixin::ErasedCallback _vl_make_callback_##MethodPtr() + +#define MIXIN_REDIRECT(MethodPtr) \ + static_assert(::vl::reflect::is_valid_method(), \ + "MIXIN_REDIRECT: invalid method pointer — missing or wrong reflection"); \ + struct _VL_REDIRECT_REG_##MethodPtr { \ + _VL_REDIRECT_REG_##MethodPtr() { \ + using _Target = typename std::remove_pointer_t; \ + ::vl::mixin::RedirectSpec spec{ \ + ::vl::reflect::method_owner(), \ + ::vl::reflect::method_name(), \ + ::vl::reflect::method_desc(), \ + ::vl::mixin::CallbackRegistry::add(_vl_make_callback_MethodPtr())\ + }; \ + ::vl::mixin::Mixin<_Target>::add(spec); \ + } \ + } _vl_redirect_reg_##MethodPtr; \ + static ::vl::mixin::ErasedCallback _vl_make_callback_##MethodPtr() + +#define MIXIN_MODIFY_CONST_INT(MethodPtr, VALUE_LITERAL) \ + static_assert(::vl::reflect::is_valid_method(), \ + "MIXIN_MODIFY_CONST_INT: invalid method pointer"); \ + struct _VL_CONST_REG_##MethodPtr { \ + _VL_CONST_REG_##MethodPtr() { \ + using _Target = typename std::remove_pointer_t; \ + ::vl::mixin::ModifyConstSpec spec{ \ + ::vl::reflect::method_owner(), \ + ::vl::reflect::method_name(), \ + ::vl::reflect::method_desc(), \ + ::vl::mixin::ModifyConstSpec::Int, (long long)(VALUE_LITERAL), 0.0, {}, \ + 0 /* static replacement by Core; no cb */ \ + }; \ + ::vl::mixin::Mixin<_Target>::add(spec); \ + } \ + } _vl_const_reg_##MethodPtr; + + +// Inject with typed lambda: signature (Self[, Args...], CallbackInfo&) +#define MIXIN_INJECT_TYPED(MethodPtr, AT_ENUM, LAMBDA) \ + struct _VL_INJECT_T_REG_##MethodPtr { \ + _VL_INJECT_T_REG_##MethodPtr() { \ + using _Target = typename std::remove_pointer_t; \ + ::vl::mixin::InjectionSpec spec{ \ + ::vl::reflect::method_owner(), \ + ::vl::reflect::method_name(), \ + ::vl::reflect::method_desc(), \ + AT_ENUM, ::vl::mixin::Side::Before, \ + ::vl::mixin::CallbackRegistry::add( \ + ::vl::mixin::make_typed_inject(LAMBDA) \ + ) \ + }; \ + ::vl::mixin::Mixin<_Target>::add(spec); \ + } \ + } _vl_inject_typed_reg_##MethodPtr; + +// Redirect with typed lambda: signature (Self[, Args...], CallbackInfoReturnable&) -> Ret or void (set via ci) +#define MIXIN_REDIRECT_TYPED(MethodPtr, LAMBDA) \ + struct _VL_REDIRECT_T_REG_##MethodPtr { \ + _VL_REDIRECT_T_REG_##MethodPtr() { \ + using _Target = typename std::remove_pointer_t; \ + ::vl::mixin::RedirectSpec spec{ \ + ::vl::reflect::method_owner(), \ + ::vl::reflect::method_name(), \ + ::vl::reflect::method_desc(), \ + ::vl::mixin::CallbackRegistry::add( \ + ::vl::mixin::make_typed_redirect(LAMBDA) \ + ) \ + }; \ + ::vl::mixin::Mixin<_Target>::add(spec); \ + } \ + } _vl_redirect_typed_reg_##MethodPtr; + + +#define MIXIN_FIELD_GET_TYPED(FieldPtr, LAMBDA, FieldT, SelfT) \ + struct _VL_FIELD_GET_T_REG_##FieldPtr { \ + _VL_FIELD_GET_T_REG_##FieldPtr() { \ + using _Target = typename std::remove_pointer_t; \ + ::vl::mixin::InjectionSpec spec{ \ + ::vl::reflect::method_owner(), \ + ::vl::reflect::method_name(), \ + ::vl::reflect::method_desc(), \ + ::vl::mixin::At::FIELD_GET, ::vl::mixin::Side::Before, \ + ::vl::mixin::CallbackRegistry::add( \ + ::vl::mixin::make_typed_field_get(LAMBDA) \ + ) \ + }; \ + ::vl::mixin::Mixin<_Target>::add(spec); \ + } \ + } _vl_field_get_typed_reg_##FieldPtr; + +#define MIXIN_FIELD_PUT_TYPED(FieldPtr, LAMBDA, FieldT, SelfT) \ + struct _VL_FIELD_PUT_T_REG_##FieldPtr { \ + _VL_FIELD_PUT_T_REG_##FieldPtr() { \ + using _Target = typename std::remove_pointer_t; \ + ::vl::mixin::InjectionSpec spec{ \ + ::vl::reflect::method_owner(), \ + ::vl::reflect::method_name(), \ + ::vl::reflect::method_desc(), \ + ::vl::mixin::At::FIELD_PUT, ::vl::mixin::Side::Before, \ + ::vl::mixin::CallbackRegistry::add( \ + ::vl::mixin::make_typed_field_put(LAMBDA) \ + ) \ + }; \ + ::vl::mixin::Mixin<_Target>::add(spec); \ + } \ + } _vl_field_put_typed_reg_##FieldPtr; + +#define MIXIN_INVOKE_BEFORE_TYPED(MethodPtr, LAMBDA) \ + struct _VL_INVOKE_B_T_REG_##MethodPtr { \ + _VL_INVOKE_B_T_REG_##MethodPtr() { \ + using _Target = typename std::remove_pointer_t; \ + ::vl::mixin::InjectionSpec spec{ \ + ::vl::reflect::method_owner(), \ + ::vl::reflect::method_name(), \ + ::vl::reflect::method_desc(), \ + ::vl::mixin::At::INVOKE, ::vl::mixin::Side::Before, \ + ::vl::mixin::CallbackRegistry::add( \ + ::vl::mixin::make_typed_invoke_before(LAMBDA) \ + ) \ + }; \ + ::vl::mixin::Mixin<_Target>::add(spec); \ + } \ + } _vl_invoke_before_typed_reg_##MethodPtr; + +#define MIXIN_INVOKE_AFTER_TYPED(MethodPtr, LAMBDA) \ + struct _VL_INVOKE_A_T_REG_##MethodPtr { \ + _VL_INVOKE_A_T_REG_##MethodPtr() { \ + using _Target = typename std::remove_pointer_t; \ + ::vl::mixin::InjectionSpec spec{ \ + ::vl::reflect::method_owner(), \ + ::vl::reflect::method_name(), \ + ::vl::reflect::method_desc(), \ + ::vl::mixin::At::INVOKE, ::vl::mixin::Side::After, \ + ::vl::mixin::CallbackRegistry::add( \ + ::vl::mixin::make_typed_invoke_after(LAMBDA) \ + ) \ + }; \ + ::vl::mixin::Mixin<_Target>::add(spec); \ + } \ + } _vl_invoke_after_typed_reg_##MethodPtr; \ No newline at end of file diff --git a/include/Mixin/Mixin.hpp b/include/Mixin/Mixin.hpp new file mode 100644 index 0000000..f62d142 --- /dev/null +++ b/include/Mixin/Mixin.hpp @@ -0,0 +1,40 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include + +namespace vl::mixin { + + template + class Mixin { + public: + using TargetClass = Target; + static constexpr std::string_view Owner = Target::Meta.internalName; + + protected: + // internal accumulation (per mixin type) + static Mixin& instance() { static Mixin inst; return inst; } + + static void add(const InjectionSpec& s) { instance().spec_.injections.push_back(s); } + static void add(const RedirectSpec& s) { instance().spec_.redirects.push_back(s); } + static void add(const ModifyConstSpec&s){ instance().spec_.constants.push_back(s); } + static void add(const ModifyVarSpec& s) { instance().spec_.vars.push_back(s); } + static void set_replace(CallbackId provider) { instance().spec_.replaceWholeClass = true; instance().spec_.classBodyProvider = provider; } + + private: + // Auto-register once per T + static inline bool _autoReg = []{ + auto &inst = instance(); + inst.spec_.owner = Owner; + Registrar::submit(inst.spec_); + return true; + }(); + + MixinSpec spec_{}; + }; + +} // namespace vl::mixin diff --git a/include/Mixin/Registrer.hpp b/include/Mixin/Registrer.hpp new file mode 100644 index 0000000..ca814d4 --- /dev/null +++ b/include/Mixin/Registrer.hpp @@ -0,0 +1,35 @@ +#pragma once +#include +#include +#include +#include + +namespace vl::mixin { + + // Core provides a function that consumes specs. API buffers until set. + using RegistrarFn = void(*)(const MixinSpec&); + + class Registrar { + public: + static void set_sink(RegistrarFn fn) { + std::lock_guard lk(mu_); + sink_ = fn; + if (!pending_.empty()) { + for (auto &s : pending_) sink_(s); + pending_.clear(); + pending_.shrink_to_fit(); + } + } + static void submit(const MixinSpec& spec) { + std::lock_guard lk(mu_); + if (sink_) { sink_(spec); } + else { pending_.push_back(spec); } + } + + private: + static inline std::mutex mu_; + static inline RegistrarFn sink_ = nullptr; + static inline std::vector pending_; + }; + +} // namespace vl::mixin diff --git a/include/Mixin/TypedAdapter.hpp b/include/Mixin/TypedAdapter.hpp new file mode 100644 index 0000000..b1848cc --- /dev/null +++ b/include/Mixin/TypedAdapter.hpp @@ -0,0 +1,207 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include + +// ---- Slot decoding helpers: these are pure API conventions that Core obeys ---- +namespace vl::mixin::detail { + +// Core passes args in this order: +// - instance methods: slot0 = pointer to Self (wrapper); then parameters 0..N-1 +// - static methods: parameters 0..N-1 +// Each slot is a pointer to the exact wrapper or to a trivially copyable primitive storage. +// +// from_slot(void*) +// Overloads convert the slot to the target C++ type T. + +template +inline T from_slot(void* p) { + // Default: value type stored directly in the slot's memory. + return *reinterpret_cast*>(p); +} + +// Specialize for references if you want by-ref semantics later. +// For object wrapper types we still copy by value (cheap handle). +template +inline T& from_slot_ref(void* p) { + return *reinterpret_cast(p); +} + +// Build tuple of arguments from slots [base .. base+N) +template +Tuple build_tuple(void** slots, std::index_sequence) { + return Tuple{ from_slot>(slots[I])... }; +} + +// Apply callable to (Self?, Args..., CallbackInfo &/Returnable&) +template +auto call_with(F&& f, Self* self, void** argSlots, CI& ci) { + if constexpr (std::is_same_v>) { + if constexpr (std::is_same_v) { + return std::invoke(std::forward(f), ci); + } else { + return std::invoke(std::forward(f), *self, ci); + } + } else { + constexpr auto N = std::tuple_size_v; + auto args = build_tuple(argSlots, std::make_index_sequence{}); + if constexpr (std::is_same_v) { + return std::apply([&](auto&&... unpacked){ + return std::invoke(std::forward(f), std::forward(unpacked)..., ci); + }, std::move(args)); + } else { + return std::apply([&](auto&&... unpacked){ + return std::invoke(std::forward(f), *self, std::forward(unpacked)..., ci); + }, std::move(args)); + } + } +} + +} // namespace vl::mixin::detail + +namespace vl::mixin { + // ----------------------- INJECT typed adapter ---------------------------------- + // Accepts F with signature: (Self[, Args...], CallbackInfo&) + // Returns ErasedCallback that Core can call. + template + vl::mixin::ErasedCallback make_typed_inject(F&& f) { + using Sig = ::vl::reflect::method_signature; + using SelfT = std::conditional_t; + using ArgsT = typename Sig::Args; + + return [fn = std::forward(f)](void** args, int argc, void* cbinfo) -> void* { + // Layout: [self?], [arg0..argN-1] + void** cursor = args; + SelfT* selfPtr = nullptr; + if constexpr (!Sig::is_static) { + selfPtr = reinterpret_cast(*cursor++); + } + // Consume parameters from remaining slots + (void)argc; // not needed with typed tuple + auto& ci = *reinterpret_cast(cbinfo); + vl::mixin::detail::call_with(fn, selfPtr, cursor, ci); + return nullptr; // inject doesn't produce a direct return value + }; + } + + // ----------------------- REDIRECT typed adapter -------------------------------- + // Accepts F with signature: (Self[, Args...], CallbackInfoReturnable&) -> Ret or void (set via ci) + template + vl::mixin::ErasedCallback make_typed_redirect(F&& f) { + using Sig = ::vl::reflect::method_signature; + static_assert(!std::is_same_v, + "REDIRECT requires method with non-void return type"); + + using RetT = typename Sig::Ret; + using SelfT = std::conditional_t; + using ArgsT = typename Sig::Args; + + return [fn = std::forward(f)](void** args, int argc, void* cbinfo) -> void* { + void** cursor = args; + SelfT* selfPtr = nullptr; + if constexpr (!Sig::is_static) selfPtr = reinterpret_cast(*cursor++); + auto& ci = *reinterpret_cast*>(cbinfo); + + if constexpr (std::is_void_v, vl::mixin::CallbackInfoReturnable&>>) { + // callable returns void, must set ci.setReturnValue(...) + vl::mixin::detail::call_with>(fn, selfPtr, cursor, ci); + if (ci.hasReturnValue()) { + // Core expects pointer to value storage + return const_cast(&ci.getReturnValue()); + } + return nullptr; // Core will fall back to original if not cancelled + } else { + // callable returns Ret directly + static RetT storage{}; + storage = vl::mixin::detail::call_with>(fn, selfPtr, cursor, ci); + ci.setReturnValue(storage); // also mark cancelled + return &storage; + } + }; + } + + // --------------------------- FIELD_GET ------------------------------------ + // lambda signature: (Self[, CallbackInfoField&]) -> void + // if cancelled and ci.hasReturnValue(), value replaces field read + template + vl::mixin::ErasedCallback make_typed_field_get(F&& fn) { + return [f = std::forward(fn)](void** args, int argc, void* cbinfo) -> void* { + (void)argc; + SelfT* self = reinterpret_cast(args[0]); + auto& ci = *reinterpret_cast*>(cbinfo); + std::invoke(f, *self, ci); + if (ci.hasReturnValue()) return const_cast(&ci.getReturnValue()); + return nullptr; + }; + } + + // --------------------------- FIELD_PUT ------------------------------------ + // lambda signature: (Self, FieldT&, CallbackInfoField&) + template + vl::mixin::ErasedCallback make_typed_field_put(F&& fn) { + return [f = std::forward(fn)](void** args, int argc, void* cbinfo) -> void* { + (void)argc; + SelfT* self = reinterpret_cast(args[0]); + FieldT* incoming = reinterpret_cast(args[1]); + auto& ci = *reinterpret_cast*>(cbinfo); + std::invoke(f, *self, *incoming, ci); + return nullptr; + }; + } + + // ------------------- INVOKE BEFORE ------------------------------------- + // lambda signature: (Self[, Args...], CallbackInfoReturnable&) + // may cancel original call and set replacement return + template + ErasedCallback make_typed_invoke_before(F&& f) { + using Sig = ::vl::reflect::method_signature; + using RetT = typename Sig::Ret; + using SelfT = std::conditional_t; + using ArgsT = typename Sig::Args; + + return [fn = std::forward(f)](void** args, int argc, void* cbinfo) -> void* { + void** cursor = args; + SelfT* selfPtr = nullptr; + if constexpr (!Sig::is_static) selfPtr = reinterpret_cast(*cursor++); + auto& ci = *reinterpret_cast*>(cbinfo); + detail::call_with(fn, selfPtr, cursor, ci); + if (ci.isCancelled() && ci.hasReturnValue()) { + return const_cast(&ci.getReturnValue()); + } + return nullptr; // continue to original invoke + }; + } + + // ------------------- INVOKE AFTER -------------------------------------- + // lambda signature: (Self[, Args...], Ret&, CallbackInfoInvokeAfter&) + template + ErasedCallback make_typed_invoke_after(F&& f) { + using Sig = ::vl::reflect::method_signature; + using RetT = typename Sig::Ret; + using SelfT = std::conditional_t; + using ArgsT = typename Sig::Args; + + return [fn = std::forward(f)](void** args, int argc, void* cbinfo) -> void* { + void** cursor = args; + SelfT* selfPtr = nullptr; + if constexpr (!Sig::is_static) selfPtr = reinterpret_cast(*cursor++); + auto& ci = *reinterpret_cast*>(cbinfo); + + // Last slot in args[] is original return value (Core places it) + RetT* retSlot = reinterpret_cast(cursor[argc - 1]); + ci.setOriginalReturn(*retSlot); + + // Call the mod callback + std::invoke(fn, *selfPtr, *retSlot, ci); + + // If cancelled and ci.hasReturnValue(), Core replaces return with it + if (ci.isCancelled() && ci.hasReturnValue()) + return const_cast(&ci.getReturnValue()); + return nullptr; + }; + } +} \ No newline at end of file diff --git a/include/Mixin/Types.hpp b/include/Mixin/Types.hpp new file mode 100644 index 0000000..ba59f7a --- /dev/null +++ b/include/Mixin/Types.hpp @@ -0,0 +1,62 @@ +#pragma once +#include +#include +#include +#include + +namespace vl::mixin { + +enum class At : std::uint8_t { HEAD, RETURN, INVOKE, FIELD_GET, FIELD_PUT }; +enum class Side: std::uint8_t { Before, After }; + +using CallbackId = std::size_t; + +// Erased ABI for callbacks: Core marshals args and provides a CallbackInfo*. +using ErasedCallback = std::function; + +struct InjectionSpec { + std::string_view owner; // internal name from generator + std::string_view methodName; // "tick" + std::string_view methodDesc; // "()V" + At at; + Side when{Side::Before}; + CallbackId cb{}; +}; + +struct RedirectSpec { + std::string_view owner; + std::string_view methodName; + std::string_view methodDesc; + CallbackId cb{}; +}; + +struct ModifyConstSpec { + std::string_view owner; + std::string_view methodName; + std::string_view methodDesc; + enum { Int, Long, Float, Double, String } kind; + long long i64{}; + double fp{}; + std::string_view str{}; + CallbackId cb{}; // optional dynamic replacement +}; + +struct ModifyVarSpec { + std::string_view owner; + std::string_view methodName; + std::string_view methodDesc; + int varIndex{}; + CallbackId cb{}; +}; + +struct MixinSpec { + std::string_view owner; // target class internal name + std::vector injections; + std::vector redirects; + std::vector constants; + std::vector vars; + bool replaceWholeClass{false}; + CallbackId classBodyProvider{}; // if replaceWholeClass +}; + +} // namespace vl::mixin diff --git a/include/Reflect/Method.hpp b/include/Reflect/Method.hpp new file mode 100644 index 0000000..53810ab --- /dev/null +++ b/include/Reflect/Method.hpp @@ -0,0 +1,34 @@ +#pragma once +#include +#include + +namespace vl::reflect { + +// Generator fills these specializations for every discoverable method pointer. +template +struct method_info { + static_assert(sizeof(MethodPtr) == 0, + "No reflection metadata found for this method pointer. " + "Did you include the generated header for this class?"); + static constexpr std::string_view owner = ""; // "net/minecraft/.../LocalPlayer" + static constexpr std::string_view name = ""; // "tick" + static constexpr std::string_view desc = ""; // "()V" + static constexpr bool is_static = false; +}; + +template +constexpr bool is_valid_method() { + // If the primary template is instantiated, owner=="" and will trip this. + return method_info::owner.size() > 0; +} + +template +constexpr std::string_view method_owner() { return method_info::owner; } +template +constexpr std::string_view method_name() { return method_info::name; } +template +constexpr std::string_view method_desc() { return method_info::desc; } +template +constexpr bool method_is_static() { return method_info::is_static; } + +} // namespace vl::reflect diff --git a/include/Reflect/Signature.hpp b/include/Reflect/Signature.hpp new file mode 100644 index 0000000..242da8b --- /dev/null +++ b/include/Reflect/Signature.hpp @@ -0,0 +1,14 @@ +#pragma once +#include +#include + +namespace vl::reflect { + + // Primary template: intentionally incomplete; generator will specialize. + template + struct method_signature; // exposes: using Self, using Ret, using Args = std::tuple<...>; static constexpr bool is_static; + + template struct is_void : std::is_same {}; + template inline constexpr bool is_void_v = is_void::value; + +} // namespace vl::reflect