Skip to content

mongodb: nan, inf #1599

Description

@AlexanderZvyagin

I have a document from mongodb which contains an array of floats: "[123, nan, inf, -inf]". It is not standard JSON, so the library correctly throws json.exception.parse_error.101

But the array has a meaning, it contains a finite float 123, not-a-number value, and +/- infinity. So the array can be converted into std::vector.

My question is: how can I achieve that in a most elegant way?! Probably the best would be to add user-defined literals (like true,false,null) which are automatically converted into floats (macros NAN and INFINITY). But I don't see that the library allows that...

Thanks a lot in advance!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: questionstate: please discussplease discuss the issue or vote for your favorite optionstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updated

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions