digitalmars.D.learn - struct Yes in std.typecons
- Peter Summerland (29/29) Nov 01 2012 The docs say:
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (7/10) Nov 01 2012 Flag!"encryption".no.
The docs say: Convenience names that allow using e.g. yes!"encryption" instead of Flag!"encryption".yes and no!"encryption" instead of Flag!"encryption".no. I could not get yes!"encription" to work. But "Yes.encription" does. Are the docs out of date? Am I missing something? E.g., module yes_no_flag; import std.stdio, std.typecons; void retval(Flag!"encryption" v) { if (v) writeln("Encryption"); else writeln("Open"); } void main() { retval(Flag!"encryption".yes); retval(Flag!"encryption".no); retval(Yes.encryption); // retval(yes!"encryption"); // Error: template instance yes!("encryption") template 'yes' is not // defined, did you mean Yes? } $> rdmd yes_no_flag.d Encryption Open Encryption
Nov 01 2012
On 11/01/2012 10:41 AM, Peter Summerland wrote:The docs say: Convenience names that allow using e.g. yes!"encryption" instead of Flag!"encryption".yes and no!"encryption" instead ofFlag!"encryption".no. The documentation is wrong. Please either file a bug report or click the "Improve this page" button on that page to submit a pull request automatically. :) (I have never tried it myself though.) Ali
Nov 01 2012