Article on Tuples

Chris Miller chris at dprogramming.com
Wed Nov 15 07:26:25 PST 2006


On Wed, 15 Nov 2006 07:53:11 -0500, Bill Baxter <wbaxter at gmail.com> wrote:

> Seeing this:
>
>    alias Tuple!(TP, 8) TR;  // TR is now float,float,3,8
>    alias Tuple!(TP, TP) TS; // TS is float,float,3,float,float,3
>
> makes me really wish the syntax for typedef/alias were:
>
>    alias newname = oldname;
>
> I always thought the ordering for C++'s typedef was goofy.  I get it  
> backwards about half the time I think, just because it's basically an  
> assignment perversely written the other way around from all other  
> assignments.
>
> --bb

Think of a variable declaration and then put alias/typedef on front of it;  
ever since I thought of it like this I never made the mistake again.

    int foo;  // new foo
    typedef int foo;  // new foo



More information about the Digitalmars-d-announce mailing list