On 10/26/13 5:13 PM, Timon Gehr wrote:
The following implementation does not use conditionals; probably not minimal.
Thanks! Fixed two minor bugs:
this(bool b) { value = b; }
void opAssign(bool b) { value = b; }
These should shift b so it becomes 2 if true. Pushed your code with the fixes and a full truth table unittest: https://github.com/andralex/phobos/blob/allocator/std/allocator.d#L236Nice work. I'd say this is nontrivial enough to be put in the standard library.
Andrei
