Answer the question
In order to leave comments, you need to log in
Template class and method how to do?
I need to parse xml, create classes that will be described in xml and fill these classes with data from attributes.
How I see it:
template<typename SetMethod>
struct XMLField{
std::string field; // название поля xml атрибута
SetMethod* method; // метод класса для установки значения из field;
uint8_t type; // тип данных, bool, string и тд.
};
template<typename ViewClass, typename method>
struct ViewOptions{
ViewClass* viewClass; // класс который будет создан при парсинге
std::vector<XMLField<method>> fields; // поля и методы этого класса
};
static std::map<std::string ,ViewOptions<>> extendXml;
template<typename Method, typename... Args>
void emit(Method&& method, Args&&... args){
for (size_t i = 0; i < events.size(); i++){
std::bind(method,events[i],std::forward<Args>(args)...)();
}
}
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