Re: Alias on an array element

2017-10-13 Thread Meta via Digitalmars-d-learn
On Friday, 13 October 2017 at 13:22:42 UTC, Adam D. Ruppe wrote: * Use a @property ref function to return the array element and trust the compiler to inline it. You could also use pragma(inline, true).

Re: Alias on an array element

2017-10-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 13 October 2017 at 01:09:56 UTC, solidstate1991 wrote: All the aliases are fail to compile, have not found anything about it in any of the documentations I checked. Like the others said, alias just renames symbols, not expressions. Think of the generated code - if you are replacing

Re: Alias on an array element

2017-10-13 Thread Igor via Digitalmars-d-learn
On Friday, 13 October 2017 at 02:04:03 UTC, Meta wrote: On Friday, 13 October 2017 at 01:12:38 UTC, solidstate1991 wrote: On Friday, 13 October 2017 at 01:09:56 UTC, solidstate1991 wrote: I'm making a struct for easy color handling Here's a code sample: ublic struct Color{ union{

Re: Alias on an array element

2017-10-12 Thread Meta via Digitalmars-d-learn
On Friday, 13 October 2017 at 01:12:38 UTC, solidstate1991 wrote: On Friday, 13 October 2017 at 01:09:56 UTC, solidstate1991 wrote: I'm making a struct for easy color handling Here's a code sample: ublic struct Color{ union{ uint raw; ///Raw representation in integer form, also

Re: Alias on an array element

2017-10-12 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 13 October 2017 at 01:09:56 UTC, solidstate1991 wrote: I'm making a struct for easy color handling Here's a code sample: ublic struct Color{ union{ uint raw; ///Raw representation in integer form, also forces the system to align in INT32. ubyte[4] colors; ///Normal

Alias on an array element

2017-10-12 Thread solidstate1991 via Digitalmars-d-learn
I'm making a struct for easy color handling Here's a code sample: ublic struct Color{ union{ uint raw; ///Raw representation in integer form, also forces the system to align in INT32. ubyte[4] colors; ///Normal representation, aliases are used for color naming.