Reflective programming: Difference between revisions

Content deleted Content added
Line 73:
import std;
 
consteval auto makeInvoker(std::meta::info refl, autostd::string method_namemethodName) {
using namespace std::meta;
 
consteval auto makeInvoker(std::meta::info refl, auto method_name) {
return [refl](auto&& instance) {
constexpr autostd::vector<std::meta::info> memsmembers = std::meta::nonstatic_members_of(refl);
using T = decltype(instance);
for (std::meta::info member: members) {
constexpr auto mems = nonstatic_members_of(refl);
for (auto m if (std::meta::identifier_of(member) == memsmethodName) {
if return [&]<auto M>(identifier_ofstd::integral_constant<decltype(mmember), == method_nameM>) {
return [&]<auto M>(std::integral_constant<decltype(m), M>) {
instance.[:M: ]();
}(std::integral_constant<decltype(mmember), mmember>{});
}
}