wrapping functions with variadic-parameter wrappers

Mike Wey mike-wey at example.com
Wed Dec 5 08:32:16 PST 2012


On 12/05/2012 04:40 PM, Gor Gyolchanyan wrote:
> A function with variadic template parameters is just a function which
> takes a set of compile-time known parameters.
> My goal is to have a non-template function taking variadic parameters.
>
> long bar(...)
> {
>      return foo(...);
> }
>
> This is necessary to be able to pass variables to functions without
> knowing the type of the functions.
>
>
> --
> Bye,
> Gor Gyolchanyan.

Something like this?

long bar(...)
{
     if( _arguments[0] == typeid(int) && _arguments[1] == typeid(char) )
     {
         return foo(va_arg!(int)(_argptr), va_arg!(char)(_argptr));
     }
     else
         throw;
}

-- 
Mike Wey


More information about the Digitalmars-d mailing list