-
-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve std.conv.to (1) #118
Conversation
| { | ||
| return to!T(cast(int) value); | ||
| } | ||
|
|
||
| /// Unsigned integers (uint and ulong) to string. | ||
| T toImpl(T, S)(S input) | ||
| if (staticIndexOf!(Unqual!S, uint, ulong) >= 0 && isSomeString!T) | ||
| if (staticIndexOf!(Unqual!S, uint, ulong) >= 0 && | ||
| isSomeString!T) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't even realize that staticIndexOf existed. Looks like it could definitely be a useful function.
|
Actually, there is one change that needs to be made before this can be merged in. The "Remove conversion feature using member template function to!T() with user type" part is going too far. Adding the opCast functionality is fine, and I think that getting rid of the to member function is fine in the long run, but the current changes will break code. The old |
…straint of S -> constraint of T) for code readability.
…ible The two templates has same purpose, but bit different behaviors. implicitlyConverts(S, T) has following semantics: is(S : T) and allow initializer conversion (T t = s; -> T t = T(s);) Including initializer conversion is inconvenience for my to!() improvement in after commits, so replace it.
1. Remove conversion feature using member template function to!T() of user type. 2-1. Support conversion feature using opCast!T() with aggregate types. 2-2. Support conversion feature using constructor like T(s) with struct types.
|
Rebase, revert removing feature that using method to, and add deprecation message. |
…dfile rdmd: Add --dependfile option
The main commit is d7aac207, and others are code formatting, bug fix, and so on.
Changes:
2-1. Support conversion feature using opCast!T() with aggregate types.
2-2. Support conversion feature using constructor like T(s) with struct types.