Skip to content

Review 2: String conversions #1187

@jzmaddock

Description

@jzmaddock

Review comment:

Without a constructor or conversion mechanism from string, when using
decimal to store numbers received off the wire one would either have to
round trip through (lossy) strtod or write a conversion function, which is
tiresome.

While I largely agree with this - lets make the easy stuff easy - I accept that cohorts and the error handling question make this harder and more controversial than it should be.

I'm inclined to suggest that an explicit constructor would be useful, with thrown exception on error in exception-enabled environments. When exception handling is off we have an issue as you rightly point out, and while we do have boost::throw_exception that aborts by default without exceptions which is non-useful, so I think I agree with your suggestion to set to NaN in that case.

Cohort behaviour needs to be clearly documented for all these conversion functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Boost ReviewCollected Comments from Boost Review PerioddocumentationImprovements or additions to documentation

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions