View mode: basic / threaded / horizontal-split · Log in · Help
March 21, 2007
Re: aliased functions
janderson Wrote:

> You could use tuples.  Not quite as neat I guess.
> 
> template Tuple(E...)
> {
>      alias E Tuple;
> }
> alias Tuple!(int, uint) myFunctionStandard;
> alias int myFunctionStandardReturn;
> 
> myFunctionStandardReturn myFunctionName(myFunctionStandard tl)
> {
>   functionContents...
> }

I figured out how to do it via mixins, which sorta worked, and slightly less syntax than the tuple.  However, Carlos suggested you already can do it via the alias:

alias int function(int x, uint y) myF;

myF bob
{
 return 0;
}

^^ That's what I remember of it.  *that* is the solution I wanted, and it actually reduces the possibility of errors, cuts redundancy and simplifies it.

Thanks Carlos.  : )
Top | Discussion index | About this forum | D home