August 11, 2004 General » Re: Enums can be annoyingly verbose... | |||
|---|---|---|---|
| |||
...with(FooBarBaz) const FooBarBaz flags = THE | QUICK | BROWN | FOX;
// C++-style
with (FooBarBaz):
const FooBarBaz... | |||
August 11, 2004 General » Re: Enums can be annoyingly verbose... | |||
|---|---|---|---|
| |||
...shouldn't happen very often). But then he loses his FooBarBaz type. ----------------------- Carlos Santander Bernal | |||
August 10, 2004 General » Re: Enums can be annoyingly verbose... | |||
|---|---|---|---|
| |||
...type int to FooBarBaz fooBar(FooBarBaz.ONE|FooBarBaz.TWO); fooBar(cast(FooBarBaz)BarBazFoo.ONE|BarBazFoo... | |||
August 10, 2004 General » Re: Enums can be annoyingly verbose... | |||
|---|---|---|---|
| |||
...enum FooBarBaz {
ONE,TWO
}
fooBar(ONE);
is not any more/less ambiguous than
fooBar(FooBarBaz... | |||
August 10, 2004 General » Re: Enums can be annoyingly verbose... | |||
|---|---|---|---|
| |||
...FooBarBaz.THE|FooBarBaz.QUICK|FooBarBaz.BROWN|FooBarBaz.FOX|FooBarBaz.JUMP|FooBarBaz.OVER|FooBarBaz.THE|FooBarBaz... | |||
August 10, 2004 General » Re: Enums can be annoyingly verbose... | |||
|---|---|---|---|
| |||
...enclose the bit you want with:
with(FooBarBaz)
{
/+ all your code you don't want... | |||
August 10, 2004 General » Re: Enums can be annoyingly verbose... | |||
|---|---|---|---|
| |||
...don't want to have to type FooBarBaz 6 times. I'm not suggesting abolishing... | |||
August 10, 2004 General » Re: Enums can be annoyingly verbose... | |||
|---|---|---|---|
| |||
...0x0100
| }
|
You can do it like this:
typedef ushort FooBarBaz;
enum : FooBarBaz
{ ... }
-----------------------
Carlos Santander Bernal
| |||
August 10, 2004 General » Enums can be annoyingly verbose... | |||
|---|---|---|---|
| |||
...FooBarBaz.THE|FooBarBaz.QUICK|FooBarBaz.BROWN|FooBarBaz.FOX|FooBarBaz.JUMP|FooBarBaz.OVER|FooBarBaz.THE|FooBarBaz... | |||
Copyright © 1999-2021 by the D Language Foundation