Problem with variable argument function in C++
- by Freezerburn
I'm trying to create a variable length function (obviously, heh) in C++, and what I have right now works, but only for the first argument. If someone could please let me know how to get this working with all the arguments that are passed, I would really appreciate it.
Code:
void udStaticObject::accept( udObjectVisitor *visitor, ... )
{
va_list marker;
udObjectVisitor *i = visitor;
va_start( marker, visitor );
while( 1 )
{
i->visit_staticObject( this );
//the if here will always go to the break immediately, allowing only
//one argument to be used
if( ( i = va_arg( marker, udObjectVisitor* ) ) )
break;
}
va_end( marker );
}
Based on my past posts, and any help posts I make in general, there is probably some information that I did not provide that you will need to know to help. I apologize in advance if I forgot anything, and please let me know what you need to know so I can provide the information.