Currently I have a macro. Its rather big and I'm wondering how to get rid of it. I'm not sure if I've just been awake for too long or it can't be done the way I want.
case DESC_VAR_LIST_OF_ITEMS:
{
__VARIABLE_DESC_LIST(CItem::PtrVectorOf, (*iter)->GetName());
}
break;
case DESC_VAR_LIST_OF_ENCHANTS:
{
__VARIABLE_DESC_LIST(CAttribute::INSTANCE::VectorOf, GAME->GetAttributeManager()->GetAttribute((*iter).attrID)->GetName());
}
break;
case DESC_VAR_LIST_OF_ITEM_INSTANCES:
{
__VARIABLE_DESC_LIST(CItemInstance::VectorOf, (*iter).GetNameAndQuantity());
}
break;
Is there a way a template or function take a parameter that will help with the access. I'm not sure how to go about it. I want a function/template to output these lists, but they each access information differently. Or maybe i should just stick with the macro.
Am i thinking about this all wrong? Maybe I should sleep and check back on it :p
I'm not sure what you mean. I'm not passing a string into a macro, I'm passing what's to be copied into the macro. That's how the list is used to get the string each time it loops. Maybe I'm thinking of what you mean wrong. I'll keep trying anyway ty.
Well I don't know if its a good way, but this works:
I put the macro mostly into a templated function. As a parameter to the function I take in a function ptr which is used to decide how the iter is used.