Answer the question
In order to leave comments, you need to log in
Registering a method when it is declared, is it possible?
It is necessary to implement a mechanism for saving data about certain class methods for further iteration and use. Note. code.
#include <iostream>
class Test {
DREFLECT(); // Директива объявления необходимой части класса для сохранения методов.
REFLECT void test_method() {std::cout << "Method1\n";}
REFLECT void test_another_method() {std::cout << "Method2\n";}
}
Др. написание.
DREFLECT class Test { ...
.cpp
for(auto method, method_name : Test::REFLECT)
{
std::cout << method_name << std::endl;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question