Enums - probably an old subject

Meta jared771 at gmail.com
Thu Nov 21 09:46:26 PST 2013


On Thursday, 21 November 2013 at 16:48:59 UTC, Steve Teale wrote:
> Could 'with' be extended to cover enum names do you think? Also 
> a supplementary question - does auto lock out some things like 
> this, are there other examples?

Is this what you mean?

enum Intention
{
	EVIL,
	NEUTRAL,
	GOOD,
	SAINTLY,
}

void main()
{
	with (Intention)
	{
		assert(EVIL == 0);
		assert(NEUTRAL == 1);
		assert(GOOD == 2);
		assert(SAINTLY == 3);
	}
}


More information about the Digitalmars-d mailing list