wrapping functions with variadic-parameter wrappers

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Wed Dec 5 12:02:39 PST 2012


kinda, but with minimal overhead and boilerplate


On Wed, Dec 5, 2012 at 8:32 PM, Mike Wey <mike-wey at example.com> wrote:

> 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
>



-- 
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121206/0f4d5cd3/attachment.html>


More information about the Digitalmars-d mailing list