alias for regular expressions
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Sep 14 00:11:37 PDT 2015
On Sunday, 13 September 2015 at 19:52:20 UTC, Thunderbird wrote:
> Thanks for your quick reply :)
To expand on that, alias in D is nothing like the C macro
preprocessor. D specifically disallows tricks like `#define true
false`. In D, aliases are just another name for a symbol. Ex:
struct Test
{
int n;
float f;
}
alias IntFloat = Test; //IntFloat is just another name for Test
Test t = Test(0, 1.0);
IntFloat inf = IntFloat(0, 1.0);
//Test and IntFloat are NOT separate types.
//Use std.typecons.Typedef for that
assert(t == inf);
assert(is(typeof(t) == typeof(inf));
More information about the Digitalmars-d-learn
mailing list