aliased functions

Dan murpsoft at hotmail.com
Wed Mar 21 06:32:31 PDT 2007


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.  : )



More information about the Digitalmars-d mailing list