Use locale independent conversion from double to string (#1099)#1155
Closed
davetcoleman wants to merge 1 commit intomoveit:melodic-develfrom
Closed
Use locale independent conversion from double to string (#1099)#1155davetcoleman wants to merge 1 commit intomoveit:melodic-develfrom
davetcoleman wants to merge 1 commit intomoveit:melodic-develfrom
Conversation
* Use locale independent conversion from double to string boost::lexical_cast<std::string>(0.1) returns "0,1" on Dutch, German and probably some other locales which boost::lexical_cast<double> fails to parse even on Dutch, German etc locales so this commit uses std::ostringstream which seems to be the only sane way to ignore locale * clang format * use std::locale::classic() instead of std::locale() std::locale() copies the global locale, which is already used at construction time of std::stringstream. So this was a noop. The global locale defaults to std::locale::classic() but it might have been set somewhere else before, so explicitly setting std::locale::classic() makes this code independent of locale settings elsewhere. * factor out conversion from double/float to string into moveit_utils * clang format * more explicit description Co-Authored-By: simonschmeisser <s.schmeisser@gmx.net> * adress documentation comments * add and use conversion functions from string to double * Don't write localized doubles to benchmark results * use template internally to avoid code duplication * Add error handling for std::string->float/double now throws a std::runtime_exception if errors occur. For planners this gets caught in planning_pipeline::PlanningPipeline::generatePlan and there are no further users of toDouble/toFloat currently * remove extra parantheses again * Code review comments by Dave
Contributor
|
This contains many merge conflicts. Replacing it by #1160. |
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.
Cherry pick of e855e7f