Skip to content
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

Issue 6255 - Add support for different base conversions in std.conv #372

Merged
merged 3 commits into from
Jan 26, 2012

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Dec 15, 2011

http://d.puremagic.com/issues/show_bug.cgi?id=6255

Now Phobos has following conversion functions:

  • to!string(int, radix)
  • parse!int(string, radix)

but doesn't have

  • to!int(string, radix)

*/
T toImpl(T, S)(S value)
T toImpl(T, S, Options...)(S value, Options opts)
if (isDynamicArray!S && isSomeString!S &&
!isSomeString!T && is(typeof({ ElementEncodingType!S[] v = value; parse!T(v); })))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the template constraint have something for Options? As it stands, I believe that if the wrong thing were passed to opts, the error would end up at the call site to parse within this function rather than at the call site of this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, my change was too hacky.
Explicit parameter uint radix is much better than implicit limited parameter opts.

@9rnsr
Copy link
Contributor Author

9rnsr commented Jan 23, 2012

Updated, and removed some conversions marked as unnecessary by the "removing top const" feature,

jmdavis added a commit that referenced this pull request Jan 26, 2012
Issue 6255 - Add support for different base conversions in std.conv
@jmdavis jmdavis merged commit 4208300 into dlang:master Jan 26, 2012
@jmdavis
Copy link
Member

jmdavis commented Jan 26, 2012

Merged.

marler8997 pushed a commit to marler8997/phobos that referenced this pull request Nov 10, 2019
Add a sponsorship button
merged-on-behalf-of: Vladimir Panteleev <CyberShadow@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants