On Friday, 5 April 2013 at 09:36:04 UTC, Dicebot wrote:
On Friday, 5 April 2013 at 09:26:30 UTC, Vadim Lopatin wrote:
On Friday, 5 April 2013 at 07:57:37 UTC, Dicebot wrote:
On Friday, 5 April 2013 at 07:32:55 UTC, Vadim Lopatin wrote:
Looks ugly, but I tried `typedef string String`, but it is deprecated; `alias string String` cannot be distinguished from just string. How to define String better? Is there a good way to define String to be compatible with string, but with the ability to distinguish between string and String in compile time?

Something like this : http://dpaste.1azy.net/ad013e4ef ?

It's as I have already implemented it. http://dpaste.1azy.net/a0393ce23

Why do you redefine constructor (it does exactly the same what default one) and prefer getter over raw alias this (thus adding necessity for opAssign)? Other than that looks pretty adequate match to desired behavior.

Thank you!

It was copy+paste from std.typecons Nullable!
Cleaned it up.
Strange thing: this code doesn't work for me if _value is protected - somewhere in CTFE generated code. "_value is unaccessible" It's hard to define exact place where it fails (inside of mixin). Tried to write different code which uses String with private _value, but cannot reproduce the same error. Leaving public _value so far.

Reply via email to