Add DoubleToStringConverter::ToShortestString overload set#159
Open
N-Dekker wants to merge 1 commit intogoogle:masterfrom
Open
Add DoubleToStringConverter::ToShortestString overload set#159N-Dekker wants to merge 1 commit intogoogle:masterfrom
DoubleToStringConverter::ToShortestString overload set#159N-Dekker wants to merge 1 commit intogoogle:masterfrom
Conversation
Contributor
Author
|
FYI, This overload set would allow cleaning up and simplifying user code like this: https://github.com/InsightSoftwareConsortium/ITK/blob/v5.2.0/Modules/Core/Common/src/itkNumberToString.cxx#L26-L41 Update (13 April 2021): Such a user code cleanup and simplification could be as follows (if this pull request gets accepted): N-Dekker/ITK@3098b88 |
a60aae6 to
4074174
Compare
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
Apr 13, 2021
Simplified ITK's `FloatingPointNumberToString` implementation by using `DoubleToStringConverter::ToShortestString` overload set, proposed by pull request google/double-conversion#159 Related to issue google/double-conversion#160 "Add generic (template) methods for to_string (float or double)", opened by Florian Loitsch (floitsch).
Allowed users to write generic code more easily, in cases where the input value is either a double, or a single-precision float. Included a unit test, `TEST(DoubleToShortestString)`. Complementary to pull request google#158 commit eee1a45 "Add `StringToDoubleConverter::StringTo<T>` member function templates"
4074174 to
270fccb
Compare
|
@N-Dekker, This PR still seems relevant, and a well-tested addition to the API. It cleanly merges on top of the master branch. Perhaps you could rebase on top of the master branch to give it a little momentum so that it is reviewed. |
hjmjohnson
approved these changes
Jan 24, 2026
hjmjohnson
left a comment
There was a problem hiding this comment.
@N-Dekker This looks like a simple addition to the API to ease use of conversions in other templated code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allowed users to write generic code more easily, in cases where the input value is either a double, or a single-precision float.
Included a unit test,
TEST(DoubleToShortestString).Complementary to pull request #158 commit eee1a45 "Add
StringToDoubleConverter::StringTo<T>member function templates"