Copy parameters from function passed as an alias
Kagamin
spam at here.lot
Thu Oct 11 09:21:44 UTC 2018
On Thursday, 11 October 2018 at 06:30:01 UTC, bauss wrote:
> To give the real world example.
>
> I'm converting a function into a soap envelope which means the
> identifiers must be the same because the parameter names passed
> in the soap envelope must have the same names.
>
> Basically what I wanted was something like:
>
> SoapEnvelope toEnvelope(alias fun)(...); // where ... is the
> parameters of fun
>
> The toEnvelope function then constructs the envelope based on
> the function name and the parameters.
>
> Within the "fun" function the soap envelope is constructed at
> compile-time and then simply sends the envelope to the soap
> client.
SoapEnvelope toEnvelope(alias fun)(Parameters!fun args)
{
SoapEnvelope envelope;
static foreach (i, name; ParameterIdentifierTuple!fun)
{
envelope.addField(name, args[i].toString());
}
}
More information about the Digitalmars-d-learn
mailing list