simple struct template

Daniel Keep daniel.keep.lists at gmail.com
Fri Mar 30 04:46:08 PDT 2007



Hendrik Renken wrote:
> Hi,
> 
> i've wrote a simple struct template:
> 
> struct Vector(T)
> {
>    T x;
>    T y;
>    T z;
> }
> 
> now i would like to define some aliases to make my programming life easier:
> 
> Vectorf for Vector!(float)
> Vectord for Vector!(double)
> 
> void main(char[][] args)
> {
>    Vectorf v;
>    v.x = 0.2f;
> }
> 
> 
> is that possible? i tried
> 
> mixin Vector!(float) Vectorf;
> alias Vector!(float) Vectorf;
> 
> with gdc 0.23. both dont work.
> 
> regards
> Hendrik

alias Vector!(float) Vectorf;
alias Vector!(double) Vectord;

Should work; if not, what error message is the compiler giving you?

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/


More information about the Digitalmars-d-learn mailing list