Flag proposal

Mafi mafi at example.org
Sat Jun 11 05:53:33 PDT 2011


Am 11.06.2011 14:07, schrieb Andrei Alexandrescu:
> On 6/11/11 4:58 AM, Mafi wrote:
>> Am 11.06.2011 01:16, schrieb Andrei Alexandrescu:
>>> Ask, and ye shall receive.
>>>
>>> https://github.com/andralex/phobos/commit/801ccc96ce56827cd0d0b608895269bdccba4330
>>>
>>>
>>>
>>
>> I like this version much more but shouldn't it also be
>> flag.KeepTerminator for consistency?
>>
>> Mafi
>
> Not sure I understand. How do you mean that?
>
> Andrei

I meant something like this:

template FlagImpl(string name) {
	enum FlagImpl : bool {
		yes = true, no = false
	}
}

//usage Flag.xy as alias for FlagImpl!"xy"
//to be consistent with yes.xy and no.xy
struct Flag {
	template opDispatch(string name) {
		alias FlagImpl!name opDispatch;
	}
}

Now, opDispatch cannot currently be a type, can it.


More information about the Digitalmars-d mailing list